Part Number Hot Search : 
LA3607 34490JI 28C256 CA3082M M3R63TCJ ZMZ20M C3225 LTC20531
Product Description
Full Text Search
 

To Download HT45R2K-A Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c ht45r2k-b HT45R2K-A revision: 1.40 date: ? a ??? 1 ?? ? 01 ? ? a ??? 1 ?? ? 01 ?
rev. 1.40 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 3 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale table of contents eates eneal eston eleton table lo aa n ssnent n eston bsolte a atns c caatests c caatests operational amplifer electrical characteristics instrumentation amplifer electrical characteristics clo ? king and pipelining .......................................................................................................... 14 p ? og ? am counte ? C pc ............. ............................................................................................. 1 ? sta ? k ...................................................................................................................................... 16 a ? it ? meti ? and logi ? unit C alu ............................................................................................ 16 p?og?am ?emo?y ......................................................................................................... 17 st ? u ? tu ? e ................................................................................................................................. 17 spe ? ial ve ? to ? s ...................................................................................................................... 17 look-up table ............. ............................................................................................................ 18 table p ? og ? am example ......................................................................................................... 19 data ?emo?y ................................................................................................................ ?0 st ? u ? tu ? e ................................................................................................................................. ? 0 spe ? ial pu ? pose data ? emo ? y .............................................................................................. ?? spe?ial fun?tion registe?s ........................................................................................ ?? indi ? e ? t add ? essing registe ? s C iar0 ? iar1 .......................................................................... ?? ? emo ? y pointe ? s C ? p0 ? ? p1 ............................................................................................... ?? a ?? umulato ? C acc ................................................................................................................ ? 3 p ? og ? am counte ? low registe ? C pcl ................................................................................... ? 3 bank pointe ? C bp .................................................................................................................. ? 4 status registe ? C status ..................................................................................................... ? 4 system cont ? ol registe ? s C ctrl0 ? ctrl1 ............. ............................................................. ??
rev. 1.40 ? ?a??? 1?? ?01? rev. 1.40 3 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale oscillator confguration ............................................................................................. 27 exte ? nal c ? ystal/ce ? ami ? os ? illato ? C hxt ............................................................................ ? 8 exte ? nal rc os ? illato ? C erc ............. ................................................................................... ? 8 inte ? nal rc os ? illato ? C hirc ............. ................................................................................... ? 9 exte ? nal 3 ? .768khz c ? ystal os ? illato ? C lxt ............. ............................................................ ? 9 lxt os ? illato ? low powe ? fun ? tion ....................................................................................... 30 inte ? nal 1 ? khz os ? illato ? C lirc ............................................................................................ 30 watchdog timer C wdt .............................................................................................. 30 wat ?? dog time ? clo ? k sou ?? e ............................................................................................... 30 wat ?? dog time ? ope ? ation .................................................................................................... 30 operating modes ......................................................................................................... 34 powe ? down ? ode ................................................................................................................. 34 reset and initialisation ............................................................................................... 36 reset fun ? tions ............. ........................................................................................................ 36 reset initial conditions .......................................................................................................... 38 input/output ports ....................................................................................................... 41 pull- ? ig ? resisto ? s ................................................................................................................. 41 po ? t a wake-up ............. ........................................................................................................ 4 ? i/o po ? t cont ? ol registe ? s ...................................................................................................... 4 ? pin-s ? a ? ed fun ? tions ............. ................................................................................................ 43 i/o pin st ? u ? tu ? es ................................................................................................................... 44 p ? og ? amming conside ? ations ............. .................................................................................... 4 ? timer/event counter s ................................................................................................. 45 time ? ? ode ............................................................................................................................ ? 0 event counte ? ? ode .............................................................................................................. ? 0 pulse widt ? ? easu ? ement ? ode ............. .............................................................................. ? 1 p ? es ? ale ? ................................................................................................................................ ?? buzze ? .................................................................................................................................... ?? i/o inte ? fa ? ing ......................................................................................................................... ? 4 p ? og ? amming conside ? ations ............. .................................................................................... ? 4 time ? p ? og ? am example ........................................................................................................ ?? vibration sensor amplifer ......................................................................................... 56 touch key module ....................................................................................................... 56 tou ?? key st ? u ? tu ? e ............................................................................................................... ? 6 touch key register defnition ................................................................................................ ? 6 tou ?? key ope ? ation .............................................................................................................. 6 ? tou ?? key inte ?? upt s ............. ................................................................................................. 63 p ? og ? amming conside ? ations ............. .................................................................................... 63 charge pump and voltage regulator ........................................................................ 63 ope ? ation ............................................................................................................................... 63 dual slope a/d converter .......................................................................................... 65 dual slope a nolog digital conve ? to ? ope ? ation ..................................................................... 67
rev. 1.40 4 ? a ??? 1 ?? ? 01 ? rev. 1.40 ? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale interrupts ...................................................................................................................... 70 inte ?? upt registe ? ................................................................................................................... 70 inte ?? upt ope ? ation ................................................................................................................. 7 ? inte ?? upt p ? io ? ity ...................................................................................................................... 74 exte ? nal inte ?? upt ............. ....................................................................................................... 74 time ? /event counte ? inte ?? upt ................................................................................................ 7 ? ? ulti-fun ? tion inte ?? upt ........................................................................................................... 7 ? a/d conve ? te ? i nte ?? upt .......................................................................................................... 76 tou ?? key inte ?? upt ................................................................................................................ 76 p ? og ? amming conside ? ations ............. .................................................................................... 76 lcd driver .................................................................................................................... 77 lcd ? emo ? y .......................................................................................................................... 77 lcd registe ? s ........................................................................................................................ 78 lcd clo ? k .............................................................................................................................. 79 lcd d ? ive ? output .................................................................................................................. 79 lcd voltage sou ?? e and biasing ........................................................................................... 80 p ? og ? amming conside ? ations ............. .................................................................................... 81 confguration options ............................................................................................................ 8 ? body fat measurement function ............................................................................... 83 sine wave gene ? ato ? ............................................................................................................. 83 amplifer ............. .................................................................................................................... 8 ? filte ? ....................................................................................................................................... 87 application circuits ........... ......................................................................................... 88 instruction set ............................................................................................................. 89 int ? odu ? tion ............................................................................................................................ 89 inst ? u ? tion timing ................................................................................................................... 89 ? oving and t ? ansfe ?? ing data ................................................................................................ 89 a ? it ? meti ? ope ? ations ............................................................................................................. 89 logi ? al and rotate ope ? ations ............. .................................................................................. 89 b ? an ?? es and cont ? ol t ? ansfe ? .............................................................................................. 90 bit ope ? ations ........................................................................................................................ 90 table read ope ? ations .......................................................................................................... 90 ot ? e ? ope ? ations ............. ....................................................................................................... 90 instruction set summary ............ ................................................................................ 91 table ? onventions .................................................................................................................. 91 instruction defnition .................................................................................................. 93 package information ... .............................................................................................. 103 80-pin lqfp (10mm 10mm) outline dimensions ............................................................. 104
rev. 1.40 4 ?a??? 1?? ?01? rev. 1.40 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale features ? operating v oltage: ? f sys = 4mhz: 2.2v~5.5v ? f sys = 8mhz: 3.3v~5.5v ? oscillator types: ? external crystal -- hxt ? external low speed crystal -- lxt ? external rc -- erc ? internal high speed rc -- hirc ? internal low speed rc -- lirc ? up to 22 bidirectional i/o lines ? one external interrupt input shar e d with an i/o lines ? one 8-bit and two 16-bit programmable timer/event counter s with overfow interrupt a 8-stage prescal er ? lcd driver with 248 segments ? 16k16 program memory ? 2568 data memory ? single differential input channel dual slope analog to digital convertor with operational amplifer ? watchdog t imer with regulator power ? buzzer output ? halt and wake-up function s to reduce power consumption ? internal voltage regulator (3.3v) and charge pump ? internal reference voltage generator (1.5v) ? 8-level subroutine nesting ? bit manipulation instruction ? 16-bit table read instruction ? up to 0.5 s instruction cycle with 8mhz system clock at v dd = 5v ? 63 powerful instructions ? all instructions in 1 or 2 machine cycles ? low voltage reset function ? one vibration sensor input ? four touch-key inputs ? body fat circuit ? 80-pin lqfp package
rev. 1.40 6 ? a ??? 1 ?? ? 01 ? rev. 1.40 7 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale general description the ht45r2k-c is an 8-bit high performance, risc architecture microcontroller device , which with its a/d converter and lcd driver , can directly interface to analog signals and to lcd panels. the device includes a range of other features such as low power consumption, i/o fexibility , timer functions, oscil lator opt ions, d ual slope a/d convertor, hal t and wake-up functi ons, watc hdog timer , v ibration sensor etc. however as the device includes all the circuitry associated with body fat measurement the device is especially suitable for this specific application area, being able to signifcantly reduce the need for the usual external components. selection table part no. program memory ht4 ? r ? k-a 4k16 ht4 ? r ? k-b 8k16 ht4 ? r ? k-c 16k16 block diagram                         
                  ?       
      ? 
     ?
??      
 ?      ?-?   

?
      ?  
 ?    
  ?  ? ??      ?       ?   ?      
   ? ? ? 
  
    ?     
rev. 1.40 6 ?a??? 1?? ?01? rev. 1.40 7 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale p in assignment pa2/bzb pa1/bz pa0/vib pa7/r esb nc pc0/tmr1/s e g0 pc1/tmr2/s e g1 pc2/s e g2 2 3 4 5 8 9 10 11 12 13 14 35 36 37 41 42 43 44 45 46 47 48 15 16 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1 51 52 53 54 55 56 57 58 59 60 61 62 63 64 49 50 pb0/ tk 1 pb1/ tk 2 pb2/ tk 3 pb3/ tk 4 pb4/ int th / lb vobgp chpc 2 vochp voreg op 5p op 5n dopap chpc 1 seg 13 seg 14 seg 15 seg 16 seg 17 seg 18 seg 19 seg 20 seg 22 seg 23 com 7/ seg 24 com 6/ seg 25 com 5/ seg 26 seg 21 com 3 com2 com1 c1 c2 sin fvl fil rf1 fvr to cp0n rfc dscc dsrc fir dsrr vss vdd ht 45 r2k-c 80 lqfp -a avss 6 7 pb5/tmr0 avdd 17 rf2 38 39 40 seg 11 seg 12 seg 10 seg 9 se g8 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 com0 vc vab dchop pa3/xt2 dopan dopao com 4/ seg 27 pc3/s e g3 pc4/s e g4 pc5/s e g5 pc6/s e g6 pc7/s e g7 pa4/xt1 pa5/osc2 pa6/osc1 pin description pin name function opt i/t o/t description pa0/ vib pa0 papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. vib vibrc vib ? ation input pa1/ bz pa1 papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. bz sfs c ? os buzze ? output pa ? / bzb pa ? papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up bzb sfs c ? os complementa ? y buzze ? output pa3/ xt ? pa3 papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. xt ? co lxt lxt pin pa4/ xt1 pa4 papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. xt1 co lxt lxt pin
rev. 1.40 8 ? a ??? 1 ?? ? 01 ? rev. 1.40 9 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale pin name function opt i/t o/t description pa ? / osc ? pa ? papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. osc ? co hxt hxt pin pa6/ osc1 pa6 papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. osc1 co hxt hxt/erc pin pa7/ res pa7 pawk st n ? os gene ? al pu ? pose i/o. registe ? enabled wake-up. res co st reset input pb0/tk1 pb0 pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. tk1 tk ? 0c1 tou ?? key 1 in put pb1/ tk ? pb1 pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. tk ? tk ? 0c1 tou ?? key ? in put pb ? / tk3 pb ? pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. tk3 tk ? 0c1 tou ?? key 3 in put pb3/tk4 pb3 pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. tk4 tk ? 0c1 tou ?? key 4 in put pb4/int pb4 pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. int ctrl1 intc0 st exte ? nal inte ?? upt input pb ? / t ? r0 pb ? pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. t ? r0 t ? r0c st exte ? nal time ? 0 ? lo ? k input pc0/ t ? r 1/ seg0 pc0 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. t ? r 1 t ? r1c st exte ? nal time ? 1 ? lo ? k input seg0 lcdout c ? os lcd segment output pc1/ t ? r ? / seg1 pc1 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. t ? r ? t ? r ? c st exte ? nal time ? ? ? lo ? k input seg1 lcdout c ? os lcd segment output p c ? / seg ? p c ? pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg ? lcdout c ? os lcd segment output pc3/seg3 pc3 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg3 lcdout c ? os lcd segment output pc4/seg4 pc4 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg4 lcdout c ? os lcd segment output p c ? / seg ? pc ? pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg ? lcdout c ? os lcd segment output pc6/seg6 pc6 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg6 lcdout c ? os lcd segment output pc7/seg7 pc7 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg7 lcdout c ? os lcd segment output seg8~seg ? 3 segn c ? os lcd segment outputs co ? 0~co ? 3 co ? n c ? os lcd ? ommon outputs co ? 4 / seg ? 7 co ? 4 lcdc c ? os lcd ? ommon output seg ? 7 lcd segment output
rev. 1.40 8 ?a??? 1?? ?01? rev. 1.40 9 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale pin name function opt i/t o/t description co ?? / seg ? 6 co ?? lcdc c ? os lcd ? ommon output seg ? 6 lcd segment output co ? 6 / seg ?? co ? 6 lcdc c ? os lcd ? ommon output seg ?? lcd segment output co ? 7 / seg ? 4 co ? 7 lcdc c ? os lcd ? ommon output seg ? 4 lcd segment output vab vab ns lcd voltage pump vc vc ns lcd voltage pump c1 c1 ns lcd voltage pump c ? c ? ns lcd voltage pump vobgp vobgp band gap voltage output pin (fo ? inte ? nal use) voreg voreg pwr regulato ? output 3.3v vochp vochp pwr c ? a ? ge pump output chpc1 chpc1 ns c ? a ? ge pump ? apa ? it o ? C positive chpc ? chpc ? ns c ? a ? ge pump ? apa ? it o ? C negative dopan dopan ns opa negative input dopap dopap ns opa positive input dopao dopao ns opa output dchop dchop ns opa c ? oppe ? pin th/lb th ns tempe ? atu ? e senso ? input lb ns low batte ? y voltage input dsrr dsrr ns r efe ? en ? e signal input dsrc dsrc ns integ ? ato ? negative input dscc dscc ns c ompa ? ato ? negative input sin sin ns sine wave output fvr fvr ns foot ? esisto ? ?? annel fvl fvl ns foot ? esisto ? ?? annel fil fil ns foot ? esisto ? ?? annel fir fir ns foot ? esisto ? ?? annel rf1 rf1 ns refe ? en ? e impedan ? e ?? annel rf ? rf ? ns refe ? en ? e impedan ? e ?? annel rfc rfc adc analog input t0 t0 opac output cp0n cp0n ns t ? e inve ? ting input of cp0 op ? n op ? n ns t ? e inve ? ting input of op ? op ? p op ? p ns t ? e non-inve ? ting input of op ? vdd vdd pwr p owe ? supply vss vss pwr g ? ound a vdd a vdd pwr analog powe ? supply a vss a vss pwr analog g ? ound note: i/t: input type; o/t: output type opt: optional by confguration option (co) or register option pwr: power; co: confguration option st: schmitt t rigger input; cmos: cmos output; nmos: nmos output hxt: high frequency crystal oscillator lxt: low frequency crystal oscillator ns: non-standard input or output
rev. 1.40 10 ? a ??? 1 ?? ? 01 ? rev. 1.40 11 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale absolute maximum ratings supply v oltage .............. ....................................................................................... v ss -0.3v to +6.0v input v oltage .............. ................................................................................... v ss -0.3v to v dd +0.3v storage t emperature ............... ................................................................................. -50 c to +125c operating t emperature .............. ................................................................................ -40 c to +85 c i ol t otal .............. .................................................................................................... ............... 150ma i oh t otal ................................................................................................................................ -100ma total power dissipation .............. ...................................................................................... 500mw note: these are stress ratings only . stresses exceeding the range specified under absolute maximum ratings may cause substantial damage to the device. functional operation of this device at other conditions beyond those listed in the specifcation is not implied and prolonged exposure to extreme conditions may affect device reliability. d.c. characteristics ope ? ating tempe ? atu ? e: -40c c to 8 ? c ta= ?? c typi ? al symbol parameter test conditions min. typ. max. unit vdd conditions v dd ope ? ating voltage f sys = 4 ? hz ? . ? ? . ? v f sys = 8 ? hz 3.3 ? . ? v v lcd lcd hig ? est voltage 0 v dd v i dd1 ope ? ating cu ?? ent (hxt ? erc ? hirc) ? v no load ? f sys = 8 ? hz adc off 4 8 ma i dd ? ope ? ating cu ?? ent (hxt ? erc ? hirc) 3v no load ? f sys = 4 ? hz adc off 0.8 1. ? ma ? v ? . ? 4.0 ma i dd3 ope ? ating cu ?? ent (hxt ? erc) 3v no load ? f sys = ?? hz adc off 0. ? 1.0 ma ? v 1. ? 3.0 ma i dd4 ope ? ating cu ?? ent (hxt ? erc ? hirc) ? v v oreg = 3.3v ? f sys = 4 ? hz adc on ? adc ? lo ? k is 1 ?? khz (all ot ? e ? analog devi ? es off) 3 ? ma i stb1 standby cu ?? ent 3v no load ? system halt ? adc ? lcd and wdt off 1 a ? v ? a i stb ? standby cu ?? ent 3v no load ? system halt ? adc and lcd off ? wdt on ? . ? ? .0 a ? v 8 1 ? a i stb3 standby cu ?? ent ( inte ? nal rc 1 ? khz ) 3v no load ? system os ? off ? adc and wdt off ? ? a ? v 6 10 a i stb4 standby cu ?? ent ( inte ? nal rc 1 ? khz ) ? v no load ? system os ? off ? adc and wdt off lcd on(1/3 r type) 380 ? 00 a i stb ? standby cu ?? ent 3v no load ? system halt ? lxt os ? slowly sta ? t -up ? wdtosc off ? lxt o n ? a ? v 1 ? a i stb6 standby cu ?? ent (lxt) ? v no load ? s ystem os ? off ? adc and wdt off ? lcd on (1/3 r type) ? (lcd bias current= 50a) 390 ? 10 a i stb7 standby cu ?? ent 3v no load ? only vib ? ation senso ? tu ? n on&vib pin ? onne ? ted a 0.1f cap to vss ? wdt off ? 4 a ? v 8 16
rev. 1.40 10 ?a??? 1?? ?01? rev. 1.40 11 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale symbol parameter test conditions min. typ. max. unit vdd conditions v il1 input low voltage fo ? i/o po ? ts ? t ? r0 ? t ? r1 ? t ? r ? and int ? v 0.0 1. ? v 0.0 0. ? v dd v v ih1 input hig ? voltage fo ? i/o po ? ts ? t ? r0 ? t ? r1 ? t ? r ? and int ? v 3. ? ? .0 v 0.8v dd 1.0v dd v v il ? input low voltage ( res) 0 0.4v dd v v ih ? input hig ? voltage ( res) 0.9v dd v dd v v lv r1 low v oltage reset confguration option: 2.1v ? .0 ? .1 ? . ? v v lvr ? confguration option: 2.55v ? .40 ? . ?? ? .70 v v lvr3 confguration option: 3.15v 3.00 3.1 ? 3.30 v v lvr4 confguration option: 3.8v 3.6 3.8 4.0 v i ol1 i/o po ? t sink cu ?? ent 3v v ol = 0.1v dd 4 8 ma ? v 10 ? 0 ma i oh1 i/o po ? t sou ?? e cu ?? ent 3v v oh = 0.9v dd - ? -4 ma ? v - ? -10 ma i ol ? lcd c ommon and s egment sink cu ?? ent 3v v ol = 0.1v dd ? 10 4 ? 0 a ? v 3 ? 0 700 a i oh ? lcd c ommon and s egment sou ?? e cu ?? ent 3v v oh = 0.9v dd -80 -160 a ? v -180 -360 a i ol3 pa7 sink c u ?? ent ? v ol = 0.1v dd ? 3 ma r ph pull- ? ig ? resistan ? e of i/o po ? ts 3v ? 0 60 100 k ? v 10 30 ? 0 k v vibwk ? inimum v oltage to w ake ? cu by t ? e v ib ? ation s enso ? input ? .4 v 100hz~1khz sine wave (note) ?? 0 mv 3v ? v charge pump and regulator v chp input voltage c ? a ? ge pump on ? . ? 3.6 v c ? a ? ge p ump off 3.7 ? . ? v v oreg output voltage no load 3.0 3.3 3.6 v v regdp1 regulato ? output voltage d ? op (c ompa ? e d wit ? no load) v dd = 3.7v~ ? . ? v c ? a ? ge pump off cu ?? ent<= 10ma 100 mv v regdp ? v dd = ? .4v ~ 3.6v c ? a ? ge pump on cu ?? ent <= 6ma 100 mv dual slope ad convertor , amplifer and band gap v adoff input offset range v oreg = 3.3v ? 00 800 v v rfgtc refe ? en ? e g ene ? ato ? t empe ? atu ? e coeffcient v oreg = 3.3v ? 0 ppm/c v ic ? r common ? ode input range amplifer, no load 0. ? v oreg -1. ? v integ ? ato ?? no load 1. ? v oreg -0. ? v 1rwh 7 hvw &lufxlw iru 9 90%:.
rev. 1.40 1 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 13 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale                  
 a.c. characteristics ope ? ating tempe ? atu ? e: -40c to 8 ? c ta= ?? c typi ? al symbol parameter test conditions min. typ. max. unit vdd conditions f sys system clo ? k (rc) ? . ? v~ ? . ? v 400 4000 khz system clo ? k ( hxt ) ? . ? v~ ? . ? v 400 4000 khz 3.3v~ ? . ? v 400 8000 khz 4. ? v ~ ? . ? v 400 1 ? 000 khz f hirc hirc osc 3v / ? v ta= ?? c - ? % 4 + ? % ? hz 3v / ? v ta= ?? c - ? % 8 + ? % ? hz ? v ta= ?? c - ? % 1 ? + ? % ? hz 3v / ? v ta= 0~70c - ? % 4 + ? % ? hz 3v / ? v ta= 0~70c - ? % 8 + ? % ? hz ? v ta= 0~70c - ? % 1 ? + ? % ? hz ? . ? v~3.6v ta= 0~70c -8% 4 +8% ? hz 3.0v ~ ? . ? v ta= 0~70c -8% 4 +8% ? hz 3.0v ~ ? . ? v ta= 0~70c -8% 8 +8% ? hz 4. ? v ~ ? . ? v ta= 0~70c -8% 1 ? +8% ? hz ? . ? v~3.6v ta= -40~8 ? c -1 ? % 4 +1 ? % ? hz 3.0v ~ ? . ? v ta= -40~8 ? c -1 ? % 4 +1 ? % ? hz 3.0v ~ ? . ? v ta= -40~8 ? c -1 ? % 8 +1 ? % ? hz 4. ? v ~ ? . ? v ta= -40~8 ? c -1 ? % 1 ? +1 ? % ? hz f erc erc osc ? v ta= ?? c ? r= 1 ? 0k - ? % 4 + ? % ? hz ? v ta= 0~70c ? r= 1 ? 0k - ? % 4 + ? % ? hz ? v ta= -40~8 ? c ? r= 1 ? 0k -7% 4 +7% ? hz ? . ? v ~ ? . ? v ta= -40~8 ? c ? r= 1 ? 0k -11% 4 +11% ? hz f ti ? er time ? i/p f ? equen ? y (t ? r0 ? t ? r1 ? t ? r ? ) ? . ? v~ ? . ? v 0 4000 khz t wdtosc wat ?? dog os ? illato ? pe ? iod 3v 4 ? 90 180 s ? v 3 ? 6 ? 130 s t res exte ? nal reset low pulse widt ? 1 s t sst system sta ? t-up time ? pe ? iod ( wake-up f ? om halt ) ? 10 ? 4 t sys t int inte ?? upt pulse widt ? 1 s t lvr low v oltage w idt ? to reset 0. ?? 1.00 ? .00 ms note: 1. t sys = 1/f sys 2. to maintain the accuracy of the internal hirc oscillator frequency , a 0.1 f decoupling capacitor should be connected between vdd and vss and located as close to the device as possible.
rev. 1.40 1? ?a??? 1?? ?01? rev. 1.40 13 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale operational amplifer electrical characteristics symbol parameter test conditions min. typ. max. unit v dd conditions dc electrical characteristics v dd supply voltage ? . ? ? . ? v i cc supply cu ?? ent pe ? signal amplifer ? v no load 1 ? 0 360 ? 00 a op0, op2 sr slew rate at unity gain 3v r l = 100k, c l = 100pf 7. ? v/s gbw gain bandwidt ? p ? odu ? t 3v r l = 100k, c l = 100pf ? ? hz op1 sr slew rate at unity gain 3v r l = 100k, c l = 100pf 7. ? v/s gbw gain bandwidt ? p ? odu ? t 3v r l = 100k, c l = 100pf ? ? hz instrumentation amplifer electrical characteristics symbol parameter test conditions min. typ. max. unit v dd condition v dd supply voltage ? . ? ? . ? v i ?? supply cu ?? ent ? v io= 0a 1. ? ma sr slew rate at unity gain 3v rl= 100k, cl= 100pf 7. ? v/s gbw gain bandwidt ? p ? odu ? t 3v rl= 100 k, cl= 100pf ? ? hz ger gain e ?? o ? -10% 10% vos input offset voltage 3v -1 ? 1 ? mv power-on reset characteristics symbol parameter test conditions min. typ. max. unit v dd conditions v por vdd sta ? t voltage to ensu ? e powe ? -on reset 100 mv rr vdd vdd rising rate to ensu ? e powe ? -on reset 0.03 ? v/ms v dcpor_ ? ax dc por ? aximum voltage 0.6 ? . ? v t por1 ? inimum time fo ? vdd stays at vpor to ensu ? e powe ? -on reset wit ? out 0.1 m f between vdd and vss ? s t por ? ? inimum time fo ? vdd stays at vpor to ensu ? e powe ? -on reset wit ? 0.1 m f between vdd and vss 10 s
rev. 1.40 14 ? a ??? 1 ?? ? 01 ? rev. 1.40 1? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale system architecture a key factor in the high-performan ce features of the holtek range of microcontrollers is attributed to the internal system architecture. the range of devices take advantag e of the usual features found within ris c microcontrollers providing increas ed s peed of operation and enhanced performance. the pi pelining sc heme i s i mplemented i n suc h a wa y t hat i nstruction fe tching a nd i nstruction execution a re ove rlapped, he nce i nstructions a re e ffectively e xecuted i n one c ycle, wi th t he exception of branch or call ins tructions. a n 8-bit w ide a lu is us ed in practically all operations of t he i nstruction se t. it c arries out a rithmetic ope rations, l ogic ope rations, rot ation, i ncrement, decrement, branch decisions, etc. the internal data path is simplifed by moving data through the accumulator and the alu. cert ain internal re gisters are im plemented in the data memory and can be directly or indirectly addressed. the simple addressing methods of these registers along with additional architectural features ensure that a minimum of external components is required to provide a functional i/o and a/d control system with maximum reliability and fexibility. clocking and pipelining the system clock, derived from an rc oscillator is subdivided into four internally generated non-overlapping cl ocks, t1~t4.the program count er is inc remented at the beginning of the t1 clock d uring wh ich t ime a n ew i nstruction i s f etched. t he r emaining t 2~t4 c locks c arry o ut t he decoding and execution functions. in this way , one t1~t4 clock cycle forms one instruction cycle. although the fetching and execution of instructions takes place in consecutive instruction cycles, the pipelining st ructure o f t he m icrocontroller e nsures t hat i nstructions a re e ffectively e xecuted i n o ne instruction cycle. the exception to this are instructions where the contents of the program counter are changed, such as subroutine calls or jumps, in which case the instruction will take one more instruction cycle to execute. for instructions involving branches, such as jump or call instructions, two instruction cycles are required to complete instruction execution. an extra cycle is required as the program takes one cycle t o frst obt ain t he a ctual j ump or c all a ddress a nd t hen a nother c ycle t o a ctually e xecute t he branch. the requirement for this extra cycle should be taken into accou nt by programmers in timing sensitive applications.                          
                                                 ?           ?  ?   ?                      ? ? ? ?                
rev. 1.40 14 ?a??? 1?? ?01? rev. 1.40 1 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale                           
                                              ? ? ? ? ?? ? ? - ? ? ?  ? ? ? ?  ? ? -? program counter C pc during pro gram e xecution, t he progr am co unter i s use d t o ke ep t rack of t he a ddress of t he next instruction to be executed. it is automatically incremented by one each time an instruction is executed except for instructions, such as jmp or call that demand a jump to a non- consecutive program memory address. i t must be noted that only the lower 8 bits, known as the program counter low register, are directly addressable by user. when execut ing instructi ons re quiring jumps to non-consecutive addresses such as a jump instruction, a subroutine call, interrupt or reset, etc. the microcontroller manages program control by loading the required address into the program counter . for conditional skip instructions, once the condition has been met, the next instruction, which has already been fetched during the present instruction execut ion, is discarded and a dummy cycle takes its place while the correct instruction is obtained. program counter p ? og ? am counte ? hig ? byte pcl registe ? low byte pc13~pc8 pcl7~pcl0                
   the lower byte of the program counter , known as the program counter low register or pcl, is available for program control and is a readable and writeable register . by transferring data directly into t his r egister, a sh ort p rogram j ump c an b e e xecuted d irectly, h owever, a s o nly t his l ow b yte is a vailable for m anipulation, t he j umps a re l imited t o t he prese nt pa ge of m emory, whi ch i s 256 locations. when such program jumps are executed it should also be noted that a dummy cycle will be inserted. the lower byte of the program counter is fully accessible under program control. manipulating the pcl might cause program branchin g, so an extra cycle is needed to pre-fetch. further information on the pcl register can be found in the special function register section.
rev. 1.40 16 ? a ??? 1 ?? ? 01 ? rev. 1.40 17 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale stack this is a special part of the memory which is used to save the contents of the program counter only. the stack is neither part of the data nor part of the program space, and is neither readable nor writeable. the activated level is indexed by the stack pointer , and is neither readable nor writeable. at a subroutine call or interrupt acknowledge signal, the contents of the program counter are pushed onto the stack. at the end of a subroutine or an interrupt routine, signaled by a return instruction, ret or reti, the program counter is restored to its previous value from the stack. after a device reset, the stack pointer will point to the top of the stack.                          
                        if the stack is full and an enabled interrupt takes place, the interrupt request fag will be recorded but acknowledge signal will be inhibited. when the stack pointer is decremented, by ret or reti, the interrupt will be serviced. this feature prevents stack overfow allo wing the programmer to use the struct ure more easily . however , when the stack is full, a call subroutine instruction can still be execu ted which will result in a stack overfow . precautions should be taken to avoid such cases which might cause unpredictable program branching. arithmetic and logic unit C alu the arith metic-logic unit or alu is a critical area of the microcontrol ler that carries out arithmetic and logic operations of the instructi on set. connected to the main micro controller data bus, the alu receives related ins truction codes and performs the required arithmetic or logical operations after which the result will be placed in the specifed register . as these alu calculation or operations may result in carry , borrow or other status changes, the status register will be correspondingly updated to refect these changes. the alu supports the following functions: ? arithmetic operations: add, addm, adc, adcm, sub, subm, sbc, sbcm, daa ? logic operations: and, or, xor, andm, orm, xorm, cpl, cpla ? rotation rra, rr, rrca, rrc, rla, rl, rlca, rlc ? increment and decrement inca, inc, deca, dec ? branch decision, jmp, sz, sza, snz, siz, sdz, siza, sdza, call, ret, reti
rev. 1.40 16 ?a??? 1?? ?01? rev. 1.40 17 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale program memory the program memory is the location where the user code or program is stored. the device is supplied with one-t ime programmable, otp , memory where users can program their application code into the device. by using the appropriate programming tools, otp devices of fer users the fexibility to freely develop their applications which may be useful during debug or for products requiring frequent upgrades or program changes. structure the program memory has a capacity of 16k16. the program memory is addressed by the program counter and also contains data, table information and interrupt entries. t able data, which can be setup in any location within the program memory, is addressed by separate table pointer registers. the device has its program memory divided into two banks, bank 0 and bank 1. the required bank is selected using bit 5 of the bp register.                
                                                ? ? ?      ? ? ? ? ? ?? -?  ? ? ?? -? ? ? ? ?  program memory structure special vectors within t he progra m me mory, c ertain l ocations a re re served for spe cial usa ge suc h a s re set a nd interrupts. ? reset vector this vect or is reserved for use by the device reset for program initialization. after a device reset is initiated, the program will jump to this location and begin execution. ? external interrupt vector this vect or is used by the external interrupt. if the external interrupt pin on the device receives an edge transition, the program will jump to this location and begin execution if the external interrupt is enabled and the stack is not full. the external interrupt active edge transition type, whether high to low, low to high or both is specifed in the ctrl1 register. ? timer/event 0/1 counter interrupt vector this internal vector is used by the t imer/event 0/1 counters. if a t imer/event counter overfow occurs, the program will jump to its respective location and begin exec ution if the associated t imer/ event counter interrupt is enabled and the stack is not full.
rev. 1.40 18 ? a ??? 1 ?? ? 01 ? rev. 1.40 19 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ? multi-function interrupt vector this vector is used by the multi-function interrupt. if t he t imer/event 2 counter overfow or t ouch key 16-bit or 10-bit counter overfow , the program will jump to this location and begin execution if the relevant interrupt is enabled and the stack is not full. ? a/d convertor interrupt vector this internal vector is used by the a/d convertor interrupt . if the a/d conversion process fnishes, the program will jump to this location and begin execution if the a/d convertor interrupt is enabled and the stack is not full. ? touch key interrupt vector this internal vector is us ed by the touch key interrupt . if the counter in the relevant t ouch key module overfow occurs , the program will jump to this location and begin execution if the touch key interrupt is enabled and the stack is not full. look-up table any location within the program memory can be defned as a look-up table where programmers can store fxed data. t o use the look-up table, the table pointer must frst be setup by placing the address of the look up data to be retrieved in the table pointer register , tblp . this register defnes the total address of the look-up table. after se tting u p t he t able p ointer, t he t able d ata c an b e r etrieved f rom t he pr ogram me mory u sing the t abrd c [m] or t abrdl[m] instructions, respectively . when the instruction is executed, the lower order table byte from the program memory will be transferred to the user defined data me mory r egister [ m] a s sp ecified i n t he i nstruction. t he h igher o rder t able d ata b yte f rom the program memory will be transferred to the tblh special register . any unused bits in this transferred higher order byte will be read as 0. the accompanying diagram illustrates the addressing data fow of the look-up table.                     
                                ?   
rev. 1.40 18 ?a??? 1?? ?01? rev. 1.40 19 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale table program example the fol lowing exam ple shows how t he t able poi nter and t able dat a i s defned and retrie ved from t he microcontroller. this example uses raw table data located in the program memory which is stored there using the org statement. the value at this org statement is 3f00h which refers to the start address of the last page within the 16k words program memory of the device. the table pointer is setup here to have an initial value of 06h. this will ensure that the frst data read from the data table will be at the program memory address 3f06h or 6 locations after the start of the last page. note that the value for the table pointer is referenced to the frst address of the present page if the t abrd c [m] instruction is being used. the high byte of the table data which in this case is equal to zero will be transferred to the tblh register automatically when the tabrd l [m] instruction is executed. because the tblh register is a read-only register and cannot be res tored, care should be taken to ensure its protection if both the main routine and interrupt s ervice routine us e table read instructions. if using the table read instructions, the interrupt service routines may change the value of the tblh and subsequently cause errors if used again by the main routine. as a rule it is recommended that simultaneous use of the table read instructions should be avoided. however , in situations where simultaneous use cannot be avoided, the interrupts should be disabled prior to the execution of any main routine table-read instructions. note that all table related instructions require two instruction cycles to complete their operation. instruction(s) table location b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 tabrdc [m] pc13 pc1 ? pc11 pc10 pc9 pc8 @7 @6 @ ? @4 @3 @ ? @1 @0 tabrdl [m] 1 1 1 1 1 1 @7 @6 @ ? @4 @3 @ ? @1 @0 table location note: 1. pc13~pc8: current program counter bits 2. @7~@0: t able pointer tblp bits 3. b13~b0: table address location bits table read program example tempreg1 db ? ;temporary register #1 tempreg2 db ? ;temporary register #2 : : mov a,06h ;initialise low table pointer - note that this ;address mov tblp,a ;is referenced : : tabrdl tempreg1 ;transfers value in table referenced by table ;pointer data at program ;memory address 3f06h transferred to tempreg1 ;and tblh dec tblp ;reduce value of table pointer by one tabrdl ;tempreg2 ;transfers value in table referenced by table ;pointer data at program ;memory address 3f05h transferred to tempreg2 ;and tblh in this ; example the data 1ah is transferred to tempreg1 ;and data 0fh to register tempreg2 : : org 3f00h ;sets initial address of program memory dc 00ah, 00bh, 00ch, 00dh, 00eh, 00fh, 01ah, 01bh
rev. 1.40 ? 0 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?1 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale data memory the data memory is a volatile area of 8-bit wide ram internal memory and is the location where temporary information is stored. structure the data memory is divided into four banks, bank0~3. the bank0 is subdivided into two sections, the frst of these is an area of ram, known as the special function data memory . here are located registers which are necessary for correct operation of the device. many of these registers can be read from and written to directly under program control, however , some remain protected from user manipulation. the second area of data memory is reserved for general purpose use. all locations within this area are read and write accessible under program control. the general purpose data memory bank1 and bank2 are dedicated for the lcd and sine pattern functions respectively while the bank3 is used for general purpose data memory . the total capacity of ge neral purpose da ta m emory, a vailable for de signer, i s 256 byt es, c omposed by ba nk0 a nd bank4. the accompanying table illustrates the data memory arrangement. capacity bank description ?? 6 8 bank 0(00h~3fh) spe ? ial fun ? tion data ? emo ? y( 64bytes) bank 0(40h~ffh) gene ? al pu ? pose data ? emo ? y(19 ? bytes) bank 1(40h~ ? bh) gene ? al pu ? pose data ? emo ? y fo ? lcd( ? 8 bytes) bank ? (40h~7fh) gene ? al pu ? pose data ? emo ? y fo ? sine p atte ? n(64 bytes) bank 3(40h~7fh) gene ? al pu ? pose data ? emo ? y(64 bytes) note: the data ram capacity consists of the general purpose data ram in bank0 and bank3, except the bank1 and bank2 which are assigned to the lcd and sine pattern functions. all microcontroller programs require an area of read/write memory where temporary data can be stored and retrieve d for use later . it is this area of ram memory that is known as general purpose data memory . this area of data memory is fully accessible by the user program for both read and write operations. by using the set [m].i and clr [m].i instructio ns individual bits can be set or reset under program control giving the user a lar ge range of fexibility for bit manipulation in the data memory. for this device, the data memory is divided into four banks, which are selected using a bank pointer. only data in bank 0 can be directly addressed, data in bank 1~ 3 must be indirectly addressed.               
                                    ??   ?  ? ??   ?      
             
                
rev. 1.40 ?0 ?a??? 1?? ?01? rev. 1.40 ? 1 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale                                                                    
  
  
                                                                   
       
                               
                          
 
 

 
 
 
 
 
 
 
 
 
 
 
 
     
                            ???  ?  ???  ?  ???
? ? ??  special purpose data memory
rev. 1.40 ?? ? a ??? 1 ?? ? 01 ? rev. 1.40 ?3 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale                 
            
             ?   
  ?  ?   
? ? ? ? ?? ? ??? general purpose data memory special purpose data memory this area of data memory is where registers, necessary for the correct operation of the microcontroller, are stored. most of the registers are both readable and writeable but some are protected and are readable only , the details of which are located under the relevant special function register section. note that for locat ions that are unused, any read instruction to these addresses will return the value 00h. special function registers to ensure successful operation of the microcontroller , certain internal registers are implemented in the data memory area. these registers ensure correct operation of internal functions such as timers, interrupts, etc., as well as external functions such as i/o data control. the location s of these registers within the data memory begin at the address 00h and are mapped into from bank 0 to bank 3 . any unused data memory locations between these special function registers and the point where the general purpose memory begins is reserved and attempting to read data from these locations will return a value of 00h. indirect addressing registers C iar0, iar1 the indirect addressing registers, iar0 and iar1, although having their locations in normal ram register space, do not actually physically exist as normal registers. the method of indirect addressing for ram data manipulation uses these indirect addressing registers and memory pointers, in contrast to direct memory addressing, where the actual memory address is specifed. actions on the iar0 and iar1 registers will result in no actual read or write operatio n to these registers but rather to the memory location specifed by their corresponding memory pointers, mp0 or mp1. acting as a pair, iar0 and mp0 can together access data from bank 0 while the iar1 and mp1 register pair can access data from any bank. as the indirect addressing registers are not physically implemented, reading the indirect addressing registers indirectly will return a result of 00h and writing to the registers indirectly will result in no operation. memory pointers C mp0, mp1 two memory pointers, known as mp0 and mp1 are provided. these memory pointers are physically implemented in the data memory and can be manipulated in the same way as normal registers providing a convenient way with which to indirectly address and track data. mp0 can only be used to indirectly address data in bank 0 while mp1 can be used to address data from bank 0 to bank 3 . when any operation to the relevant indirect addressing registers is carried out, the actual address that the microcontroller is directed to, is the address specifed by the related memory pointer . note that indirect addressing using mp1 and iar1 must be used to access any data in bank 1~bank 3. the following example shows how to clear a section of four data memory locations already defned as locations adres1 to adres4.
rev. 1.40 ?? ?a??? 1?? ?01? rev. 1.40 ? 3 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale indirect addressing program example data .section data adres1 db ? adres2 db ? adres3 db ? adres4 db ? block db ? code .section at 0 code org00h start mov a 04h ;setup size of block mov block a mov a offset adres1 ;accumulator loaded with frst ram address mov mp0 a ;setup memory pointer with frst ram address loop clr iar0 ;clear the data at address defned by mp0 inc mp0 ;increment memory pointer sdz block ;check if last memory location has been cleared jmp loop continue accumulator C acc 7kh ffxpxodwru lv fhqwudo wr wkh rshudwlrq ri dq plfurfrqwuroohu dqg lv forv ho uhodwhg z lwk rshudwlrqv fduulhg rxw wkh /8 7kh ffxpxodwru lv wkh sodfh zkhuh doo lqwhuphgldwh uhvxowv iurp wkh /8 duh vwruhg : lwkrxw wkh ffxpxodwru lw zrxog h qhfhvvdu wr zulwh wkh uhvxow ri hdfk f dofxodwlrq ru o rjlfdo rsh udwlrq vxf k d v d gglwlrq vxw udfwlrq vkl iw h wf w r w kh d wd 0h pru uhvxowlqj l q kljkh u surjudp plqj dqg w lplqj ryhukhdgv d wd w udqvihu rshudw lrqv xvxdo o l qyroyh wkh w hpsrudu vw rudjh ixqf wlrq ri w kh f fxpxodwru iru h [dpsoh zk hq w udqvihuulqj gd wd h wzhhq rqh xvhu ghil qhg uhjl vwhu dqg dqrw khu lw lv qhfhvvdu wr gr wklv sdvvlqj wkh gdwd wkurxjk wkh ffxpxodwru dv qr gluhfw wudqvihu hwzhhq wzr uhjlvwhuv lv shuplwwhg program counter low register C pcl 7r surylgh dgglwlrqdo surjudp frqwuro ixqfwlrqv wkh orz wh ri wkh 3urjudp &rxqwhu lv pdgh dffhvvloh wr surjudpphuv orfdwlqj lw zlwklq wkh 6shfldo 3xusrvh duhd ri wkh dwd 0hpru pdqlsxodwlqj wklv uhjlvwhu gluhfw mxpsv wr rwkhu surjudp orfdwlrqv duh hdvlo lpsohphqwhg /rdglqj d ydoxh gluhfwo lqwr wklv 3&/ uhjlvwhu zloo fdxvh d mxps wr wkh vshflhg 3urjudp 0hpru orfdwlrq rzhyhu dv wkh uhjlvwhu lv rqo lw zlgh rqo mxpsv zlwklq wkh fxuuhqw 3urjudp 0hpru sdjh duh shuplwwhg :khq vxfk rshudwlrqv duh xvhg qrwh wkdw d gxpp ffoh zloo h lqvhuwhg
rev. 1.40 ? 4 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale bank pointer C bp in this device, the program and data memory are divided into several banks. selecting the required program and data memory area is achieved using the bank pointer . bit 5 of the bank pointer is used to select program memory bank 0 or 1, while bits 0~ 1 are used to select data memory banks 0~3 . the data memory is initialised to bank 0 after a reset, except for the wdt time-out reset in the power down mode, in which case, the data memory bank remains unaf fected. it should be noted that special function data memory is not af fected by the bank selection, which means that the special function registers can be accessed from within any bank. directly addressing the data memory will always result in bank 0 being accessed irrespective of the value of the bank pointer . accessing data from banks other than bank 0 must be implemented using i ndirect addressing. as both the program memory and data memory share the same bank pointer register , care must be taken during programming. bp register bit 7 6 5 4 3 2 1 0 name p ? bp0 d ? bp1 d ? bp0 r/w r/w r/w r/w por 0 0 0 bit 7 ~ 6 unimplemented, read as 0 bit 5 : program memory bank pointer 0: bank 0, program memory address is from 0000h ~ 1fffh 1: bank 1, program memory address is from 2000h ~ 3fffh bit 4 ~ 2 unimplemented, read as 0 bit 1 ~ 0 : data memory bank pointer 00: bank 0 (for general purpose) 01: bank 1 (for lcd) 10: bank 2 (for sine generator) 11: bank 3 (for general purpose) status register C status this 8-bit regis ter contains the zero flag(z), carry flag (c), auxiliary carry flag(a c), overflow flag(ov), power down flag(pdf), and watchdog time-out flag(t o). these arithmetic/logical operation and system management flags are used to record the status and operation of the microcontroller. with the exceptio n of the t o and pdf fags, bits in the status register can be altered by instructions like any other register . any data written into the status register will not change the t o and pdf flags. in addition operations related to the status register may give dif ferent results from those intended. the t o fag can be af fected only by system power -up, a wdt time-out or executing the halt or clr wdt instruction. the pdf fag can be af fected only by executing the hal t or clr wdt instruction or a system power-up. the z, ov, c, ac fags generally refect the statuses of the latest operations. in addition, on entering the interrupt sequence or executing the subroutine call, the status register will not be pushed onto stack automatically . if the contents of status are important and the subroutine can corrupt the status register , the programmer has to take precautions to save it properly.
rev. 1.40 ?4 ?a??? 1?? ?01? rev. 1.40 ?? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale status register bit 7 6 5 4 3 2 1 0 name to pdf ov z ac c r/w r r r/w r/w r/w r/w por 0 0 x x x x "x" unknown bit 7~6 unimplemented, read as "0" bit 5 to : w atchdog t ime-out fag 0: after power up or executing the "clr wdt" or "halt" instruction 1: a watchdog time-out occurred. bit 4 pdf : power down fag 0: after power up or executing the "clr wdt" instruction 1: by executing the "halt" instruction bit 3 ov : overfow fag 0: no overfow 1: an operation results in a carry into the highest-order bit but not a carry out of the highest-order bit or vice versa. bit 2 z : zero fag 0: the result of an arithmetic or logical operation is not zero 1: the result of an arithmetic or logical operation is zero bit 1 ac : auxiliary fag 0: no auxiliary carry 1: an operation results in a carry out of the low nibbles in addition, or no borrow from the high nibble into the low nibble in subtraction bit 0 c : carry fag 0: no carry-out 1: an operation results in a carry during an addition operation or if a borrow does not take place during a subtraction operation c is also affected by a rotate through carry instruction system control registers C ctrl0, ctrl1 these registers are used to provide control o ver various internal functions. some of these include the timer/event counter 2 internal source option , the lcd driver clock (fsub) option, power down mode clock control, certain system clock options, external interrupt edge trigger type, and the 32.768khz crystal oscillator (lxt) enable contr ol. ctrl0 register bit 7 6 5 4 3 2 1 0 name tcks1 tcks0 lfs lcdck1 lcdck0 fsubc fsubs lxtlp r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 1 bit ~6 tcks1~tcks0 : t imer/event counter 2 internal source selection 0 0: l (low frequency clock) 0 1: f ref (reference frequency clock generated from t ouch key module) 10: f sen (sensor frequency clock generated from t ouch key module) 11: f tmck (gated sensor frequency clock generated from t ouch key module) if the t ouch key module is disabled, the tcks1 and tcks0 bits are always set to 00 and can not be written to.
rev. 1.40 ? 6 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?7 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale bit 5 lfs : low frequency clock source f l selection 0: lirc oscillator 1: lxt oscillator bit 4 ~3 lcdck1~lcdck0 : to select the lcd driver clock 00: lcd clock = f sub /3 01: lcd clock = f sub /4 10 : lcd clock = f sub /8 11: lcd clock = f sub /8 bit2 fsubc : f sub power down mode clock control 0: disabled 1: enabled bit1 fsubs : f sub clock source selection 0: lirc oscillator 1: lxt oscillator bit0 lxtlp : lxt oscillator low power control function 0: lxt oscillator quick start-up mode 1: lxt oscillator low power mode name eintc1 eintc0 bzcs lxten r/w r/w r/w r/w r/w por 0 0 0 1 bit 7 ~6 eintc1, eintc0 : external interrupt edge selection 00: disable 01: falling edge trigger 10: rising edge trigger 11: dual edge trigger bit 5 ~2 unimplemented, read as 0 bit 1 bzcs : buzzer clock source selection 0: from t imer/event counter 0 1: from t imer/event counter 1 bit 0 lxten : lxt oscillator control in power down mode 0: disabled 1: enabled
rev. 1.40 ?6 ?a??? 1?? ?01? rev. 1.40 ? 7 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale oscillator confguration the device provides three system oscillator circuits known as a crystal oscillator (hxt), an external rc oscill ator (erc) and an internal high speed rc oscillator (hirc) which are used for the system clock. there are also an internal 12khz rc (lirc) and a 32.768khz crystal oscillator (lxt) which can provide a source clock for the wdt clock named f s , the lcd driver clock, named f sub and the timer/event counters low frequency clock, named f l ,for various timing purposes. erc lxt lirc high frequency oscillation ( hosc ) low frequency oscillation ( losc ) lfs f l f sys f sys /4 f sub wdt timer fs hirc hxt configuration option ?halt? oscon f sys fsubs lcd ?halt? fsubc prescaler (/3, /4, /8 ) lcdck [1:0] f sys / 4 configuration option system clock confgurations in t he po wer down m ode, t he syst em osc illator, t he i nternal 12khz rc osc illator (l irc) or t he external 3 2.768khz c rystal o scillator ( lxt) m ay b e e nabled o r d isabled d epending u pon t he corresponding clock control bit described in the relevant sections. the system can be woken-up from the power down mode by the occurrence of an interrupt, a transition determined by confguration options o n a ny o f t he po rt a p ins, a w dt o verfow o r a t imer o verfow. t he a ccompanying t able illustrates the oscillator type list. type name freq. pins exte ? nal c ? ystal hxt 400khz~ 1 ? ? hz osc1/osc ? exte ? nal rc erc 400khz~ 1 ? ? hz osc1 inte ? nal hig ? speed rc hirc 4 ? 8 o ? 1 ?? hz exte ? nal low speed c ? ystal lxt 3 ? .768khz xt1/ xt ? inte ? nal low speed rc lirc 1 ? khz oscillator types
rev. 1.40 ? 8 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?9 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale external crystal/ceramic oscillator C hxt the external crystal/ceramic system oscillator is one of the system oscillator choices, which is selected via confguration options. for most crystal oscillator confgurations, the simple connection of a crysta l across osc1 and osc2 will create the necessary phase shift and fe edback for oscillation, wi thout r equiring e xternal c apacitors a nd r esistors. ho wever, i f a r esonator i nstead o f crystal is connecte d between osc1 and osc2, to ensure oscillation, it may be necessary to add two small value capac itors, c1 and c2. using a ceramic resonator will usually require two small value capacitors, c1 and c2, to be connected for oscillation to occur . the values of c1 and c2 should be selected in consultation with the crystal or resonator manufacturers specifcation. for oscillator stability and to minimise the ef fects of noise and crosstalk, it is important to ensure that the crystal and any associated resistors and capacitors along with inter connecting lines are all located as close to the mcu as possible.                    
                 
  
      
       ?
? ??  ??            
    
external rc oscillator C erc using t ? e erc os ? illato ? only ? equi ? es t ? a t a ? esisto ?? wit ? a value between ? 4k and 1. ?? ? is ? onne ? ted between osc1 and vdd ? and a ? apa ? ito ? is ? onne ? ted between osc1 and g ? ound ? p ? oviding a low ? ost os ? illato ? ? onfigu ? ation. it is only t ? e exte ? nal ? esisto ? t ? at dete ? mines t ? e os ? illat ion f ? equen ? y; t ? e exte ? nal ? apa ? ito ? ? as no influen ? e ove ? t ? e f ? equen ? y and is ? onne ? ted fo ? stability pu ? poses only. devi ? e t ? imming du ? ing t ? e manufa ? tu ? ing p ? o ? ess and t ? e in ? lusion of inte ? nal f ? equen ? y ? ompensation ? i ?? uits a ? e used wrhqvxuhwkdwwkhlqxhqfhriwkhsrzhuvxssoyrowdjhwhpshudwxuhdqgsurfhvvyduldwlrqv on t ? e os ? illation f ? equen ? y a ? e minimised. as a ? esistan ? e/ f ? equen ? y ? efe ? en ? e point ? it ? an be noted t ? at wit ? an exte ? nal 1 ? 0k ? esisto ? ? onne ? ted and wit ? a ? v voltage powe ? supply and tempe ? atu ? e of ?? deg ? ees ? t ? e os ? illato ? will ? ave a f ? equen ? y of 4 ? hz wit ? in a tole ? an ? e of ? %. he ? e only t ? e osc1 pin is used ? w ? i ?? is s ? a ? ed wit ? i/o pin pa6 ? leaving pin pa ? f ? ee fo ? use as a no ? mal i/o pin. fo ? os ? illato ? stability and to minimise t ? e effe ? ts of noise and ?? osstalk ? it is impo ? tant to lo ? ate t ? e ? apa ? ito ? and ? esisto ? as ? lose to t ? e ? cu as possible.            external rc oscillator C erc
rev. 1.40 ?8 ?a??? 1?? ?01? rev. 1.40 ? 9 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale internal rc oscillator C hirc the internal rc oscillator is a fully integrated system oscillator requiring no external components. the i nternal r c o scillator h as t hree fx ed f requencies o f e ither 4 mhz, 8 mhz o r 1 2mhz. de vice trimming during the manufacturing process and the inclusion of internal frequency compensation circuits are used to ensure that the infuence of the power supply voltage, temperature and process variations on the oscillation frequency are minimised. as a result, at a power supply of either 3v or 5v and at a temperature of 2 5 degrees, the fxed oscillation frequency of 4mhz, 8mhz or 12mhz will have a tolerance within 2%. note that if this internal system clock option is selected, as it requires no external pins for its operation, i/o pins pa5 and pa6 are free for use as normal i/o pins. external 32.768khz crystal oscillator C lxt the external 32.768khz crys tal o scillator is one of the low frequency oscillator choices, w hich is se lected v ia a c onfguration o ption. t his c lock so urce h as a fx ed f requency o f 3 2.768khz a nd requires a 32.768khz crystal to be connected between pins xt1 and xt2. the external resistor and capacitor components connected to the 32.768khz crystal are necessary to provide oscillation. for applications where precise frequencies are essential, these components may be required to provide frequency compen sation due to dif ferent crystal manufacturing toleranc es. during power -up there is a time delay associated with the lxt oscillator waiting for it to start-up. when t he m icrocontroller e nters t he powe r down mode , t he syst em c lock i s swi tched of f t o st op microcontroller activity and to conserve power . however , in many microcontroller applications it may be necessary to keep the internal timers operational even when the microcontroller is in the power down mode. t o do this, another clock, independent of the system clock, must be provided. the exact values of c1 and c2 should be selected in consultation with the crystal or resonator manufacturers specifcation. the external parallel feedback resistor, rp, is required. for oscillator stability and to minimise the ef fects of noise and crosstalk, it is important to ensure that the crystal and any associated resistors and capacitors along with inter connecting lines are all located as close to the mcu as possible.                     
                        ?     ?           ?  ?? ??-? ? ?  ?        
           lxt oscillator c1 and c2 values crystal frequency c1 c2 3 ? 768hz 8pf 10pf note: 1. c1 and c ? values a ? e fo ? guida n ? e only. ? . r p 0a0lvuhfrpphqghd. 32768hz c rystal recommended capacitor values
rev. 1.40 30 ? a ??? 1 ?? ? 01 ? rev. 1.40 31 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale lxt oscillator low power function the lxt oscillator can function in one of two modes, the quick start mode and the low power mode. the mode selection is executed using the lxtlp bit in the ctrl0 register. lxtlp bit lxt mode 0 qui ? k sta ? t 1 low-powe ? after power on, the lxtlp bit will be automatically cleared to zero ensuring that the lxt oscillator is in the quick start operating mode. in the quick start mode the lxt oscillator will power up and stabilise quickly . however , after the lxt oscillator has fully powered up it can be placed into t he l ow-power m ode b y se tting t he l xtlp b it h igh. t he o scillator wi ll c ontinue t o r un b ut with reduced current consumption, as the higher current consumption is only required during the lxt oscillator start-up. in power sensitive applications, such as battery applications, where power consumption must be kept to a minimum, it is therefore recommended that the application program sets the lxtlp bit high about 2 seconds after power-on. it shou ld be no ted t hat, no m atter wha t c ondition t he l xtlp bi t i s se t t o, t he l xt osc illator wi ll always function normally; the only dif ference is that it will take more time to start up if in the low- power mode. internal 12khz oscillator C lirc the internal 12khz rc oscillator is one of the low frequency oscillator choices, which is selected via confguration option. it is a fully integrated rc oscillator with a typical period of approximately 65us at 5v , requiring no external components for its implementation. if the system enters the power down mode, the internal rc oscillator can still continue to run if its clock is necessary to be used to clock the functions for timing purpose s uch as the wd t function, lcd d river or t imer/event counters . the i nternal rc osc illator c an be di sabled onl y whe n i t i s not use d a s t he c lock sourc e for a ll t he peripheral functions determined by the confguration options of the wdt function and the relevant control bits which determine the clock is enabled or disabled for related peripheral functions. watchdog timer C wdt the w atchdog t imer is provided to prevent program malfunctions or sequences from jumping to unknown locations, due to certain uncontrollable external events such as electrical noise. watchdog timer clock source the wdt is implemented using an internal 12khz rc oscillator known as lirc, the external lxt 32.768khz oscillator or the instruction clock which is the system clock divided by 4. watchdog timer operation the timer is designed to prevent a software malfunction or sequence from jumping to an unknown location with unpredictable results. a confguration option determines whether the w atchdog t imer is to be always on or whether its enable/disable control is under software control. if the confguration option chooses the always on option, then any we4~we0 values other than 01010 or 10101 will result i n a n mcu re set be ing ge nerated. if t he c onfguration opt ion c hooses t he soft ware c ontrol option then the w atchdog t imer can be disabled by setting the we4~we0 bits to a 10101 value. a value of 01010 will enable the w atchdog t imer and any other value will generate an mcu reset. the actual reset will be generated after 2~3 lirc clock cycles.
rev. 1.40 30 ?a??? 1?? ?01? rev. 1.40 31 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale wdt confg. option we4 ~ we0 bits wdt function always on 01010 enabled 10101 enabled ot ? e ? values ? cu ? eset gene ? ated afte ? ? ~3 lirc ? lo ? k ? y ? les softwa ? e cont ? ol 01010 enabled 10101 disabled ot ? e ? values ? cu ? eset gene ? ated afte ? ? ~3 lirc ? lo ? k ? y ? les wdt functional control summary the application can generate a software reset by writing a value other than 01010 and 10101 into the we4~we0 bits. if this is done then the wrf fag in the wdtc1 register will be set. the w dt c lock i s di vided by a n i nternal c ounter t o gi ve a ra tio di vision wi th a ra nge of 2 8 ~2 15 selected using the ws0~ws2 bits, to give a longer watchdog time-out period. if the watchdog timer is disabled, the wdt timer will not generate a chip reset. so in the watchdog timer disable mode, the wdt timer counter can be read out and can be cleared. this function is used for the application program to access the wdt frequency to get the temperature coeffcient for analog component adjustment. the lirc oscillator can be disabled or enabled by the oscillator enable control bits lircen1 and lircen0 in the wdt control register wdtc for power saving reasons . there are three registers related to the wdt function named wdtc, wdtc1 and wdtd. the wdtc a nd w dtc1 r egisters c ontrol t he w dt o scillator e nable/disable a nd t he w dt p ower source. the wdtd register is the wdt counter content register and is read only. the wdt power source selection bits named lircpwr1 and lircpwr0 are used to choose the wdt p ower so urce. t he w dt d efault p ower so urce i s f rom voc hp. t he m ain p urpose o f t he regulator is to be used for wdt t emperature-coeffcient adjustment. in this case, the application program s hould enable the regulator before sw itching to the regulator s ource. the lircen1 and lircen0 bits can be used to enable or disable the lirc oscillator . if the application does not use the lirc oscillato r, then it needs to disable it in order to save power . when the lirc oscillator is disabled, then it is actually turned of f, regardles s of the s etting of the relevant control bits w hich select the lirc oscillator as its clock source. when the lirc oscillat or is enabled, it can be used as the clock source in the power down mode defined by the corresponding control bits of the peripheral functions. the wdt clock source may also come from the instruction clock, in which case the wdt will operate in the same manner except that in the power down mode the wdt may stop counting and lose its protecting purpose. if the device operates in a noisy environment, using the on-chip lirc oscillator is strongly recommended, since the halt instruction will stop the system clock. when the wdt overfows under normal operation a device reset will be executed and the status bit to will be set. in the power down mode, the overfow executes a warm reset, here only the pc and sp bits are reset to zero. there are three methods to clear the contents of the wdt , an external reset - a low level on res -, a software instruction or a halt instruction. there are two types of software instructions; the single clr wdt instruction, or the pair of instructions, clr wdt1 and clr wdt2. of these two types of instruction, only one type of i nstruction ca n be ac tive at a t ime depending on t he confgura tion opti on C cl r wdt t imes selection option. if the clr wdt is selected (i.e., clr wdt times equal one), any execution of the clr wdt instruction clears the wdt . if the clr wdt1 and clr wdt2 option is chosen (i.e., cl r w dt t imes e qual t wo), t hese t wo i nstructions ha ve t o be e xecuted t o c lear t he w dt, otherwise the wdt may reset the device due to a time-out.
rev. 1.40 3 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 33 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale                     
      
                  
   

     ? 
?? 
   ? ?    ? ?-         ?   ?  ? 
 ?   ?  ?   ? ?   ?    ?     ?  ?   ?     ?  ?   ???   ??      ? ?    -  ?    ?    ? ?   ?  watchdog timer wdtc register bit 7 6 5 4 3 2 1 0 name ws ? ws1 ws0 lircen1 lircen0 lircpwr1 lircpwr0 r/w r/w r/w r/w r/w r/w r/w r/w por 1 1 1 s s 0 1 bit 7~5 ws2~ws0 : wdt prescaler rate select 000: 2 8 /f 001: 2 /f 010: 2 10 /f 011: 2 11 /f 100: 2 12 /f 101: 2 13 /f 110: 2 14 /f 111: 2 15 /f bit 4 unimplemented, read as "0" bit 3~2 lircen1 ~ lircen0 : lirc oscillator enable/disable control bits 00: lirc oscillator is enabled 01: lirc oscillator is disabled 10: lirc oscillator is enabled 11: lirc oscillator is enabled it is strongly recommended to use 10 for wdt osc enable bit 1~0 lircpwr1~ lircpwr0 : lirc power source select 00: wdt power comes from vochp 01: wdt power comes from vochp 10: wdt power comes from regulator 11: wdt power comes from vochp it i s st rongly re commended t o use 01 for vochp t o pre vent t he noi se t o l et t he wdt lose the power the wdt clock (f ) is further divided by an internal counter to give longer watchdog time-out period. in this device, the division ratio can be varied by selecting dif ferent values of ws2~ws0 bits to give 2 8 /f to 2 15 /f division ratio range.
rev. 1.40 3? ?a??? 1?? ?01? rev. 1.40 33 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale wdtc1 register bit 7 6 5 4 3 2 1 0 name we4 we3 we ? we1 we0 lvrf lrf wrf r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 1 0 1 0 x 0 0 bit 7 ~ 3 we4~we0 : wdt enable/disable/mcu reset control 01010b: enable C power on value 10101b: function depends upon wdt confguration option. for the wdt always on option this value will enable the wdt . for the software control option this value will disable the wdt . other values: generates mcu reset after 2~3 lirc clock cycles. bit 2 lvrf : lvrf reset fag 0: lvr not active 1: lvr active this bit can be cleared to 0 by the application program, but can not be set to 1. bit 1 lrf : reset caused by l vrc setting 0: not active 1: active this bit can be cleared to 0 by the application program, but can not be set to 1. bit 0 wrf : reset generated by we4~we0 bits wdtd register bit 7 6 5 4 3 2 1 0 name wdtd7 wdtd6 wdtd ? wdtd4 wdtd3 wdtd ? wdtd1 wdtd0 r/w r r r r r r r r por 0 0 0 0 0 0 0 0 bit 7~0 wdtd7~ wdtd0 : wdt counter value (bit 4~bit 11) this register is read only and used for temperature adjusting
rev. 1.40 34 ? a ??? 1 ?? ? 01 ? rev. 1.40 3? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale operating modes the devic e has two operational modes, the normal mode and the power down mode. in the normal mode, the high speed system clock may come from external rc (erc), external crystal (hxt) or interna l rc (hirc) oscillator . when in the power down mode, the clocks in this device are all enabled or di sabled using software. the accompanying tabl e illustrates the operating modes and system clock control. operating mode control halt instruction mode system oscillator fsubc f sub clock lxten lxt oscillator (xt1/xt2) not exe ? uted no ? mal on x enable x on exe ? uted powe ? down on(oscon=1) off(oscon=0) 0 disable 1 on powe ? down on(oscon=1) off(oscon=0) 1 enable 1 on powe ? down on(oscon=1) off(oscon=0) 0 disable 0 off powe ? down on(oscon=1) off(oscon=0) 1 enable 0 off note: the lircen1 and lircen0 bits in the wdtc register can be setup to enable the lirc. if the lvr i s e nabled, t hen t he l irc wi ll a lso b e e nabled. ho wever, a s t he l irc i s p owered b y t he internal v oltage re gulator, whi ch i s c ontrolled by t he re gen bi t i n t he chprc re gister, t hen when the regen bit is cleared to zero, the lirc and the l vr will both be disabled. therefore, the regen bit should be set 1 to enable these two functions. refer to the wdt section for the details regarding the wdt osc setup. power down mode the power down mode is initialised by the halt instruction and results in the following. ? the system oscillator stops running if the system oscillator is selected to be turned off by clearing the oscon bit in the haltc register to zero. otherwise, the system oscillator will keep running if it is selected to be turned on in the power down mode. ? the contents of the data memory and of the registers remain unchanged. ? the wdt is cleared and starts recounting if the wdt clock source is from the lirc or the lxt oscillator. ? all i/o ports maintain their original status. ? the pdf fag is set but the t o fag is cleared. ? the lcd driver keeps running if the lcd clock f sub is enabled by setting the fsubc bit high and the lcdon bit in the haltc register is set high. the system leav es the power down mode by means of an external reset, an interrupt, an external transition signal on port a, or a wdt overfow . an external reset causes a device initialisation, and the wdt overfow performs a warm reset. after examining the t o and pdf fags, the reason for the device reset can be determined. the pdf fag is cleared by system power -up or by executing the clr wdt instructio n, and is set by executing the halt i nstruction. on t he ot her ha nd, t he t o fa g i s se t i f w dt t ime-out oc curs, and causes a wake-up that only resets the program counter and sp , and leaves the others in their original state.
rev. 1.40 34 ?a??? 1?? ?01? rev. 1.40 3 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale the port a wake-up and interrupt methods can be considered as a conti nuation of normal execution. each pin of port a can be independently selected to wake-up the device using configuration options. after awakening from an i/o port stimulus, the program will resume execution at the next instruction. however , if awakening from an interrupt, two sequences may occur . if the related interrupt i s di sabled or t he i nterrupt i s e nabled bu t t he st ack i s ful l, t he pr ogram wi ll re sume execution at the next instruction. but if the interrupt is enabled, and the stack is not full, the regular interrupt response takes place. when an interrupt request flag is set before entering the hal t status, the system cannot be awakened using that interrupt. if a wake-up events occur , it takes a number of clock cycles to resume normal operation. in other words, a dummy period is ins erted after the w ake-up. if the w ake-up res ults from an interrupt acknowledgment, t he a ctual i nterrupt subrout ine e xecution i s de layed by m ore t han one c ycle. however, if the wake-up results in the next instruction execution, the execution will be performed immediately after the dummy period is fnished. t o minimise power consumption, all the i/o pins should be carefully managed before entering the halt status. the accompanying table illustrates the wake-up delay time for dif ferent sys tem clock sources .the sst time is decided by sst confguration option and the oscon bit in the haltc register. fsys clock source sst selection oscon sst time ( n: number of fsys clock ) xtal 0 0 n= 10 ? 4 0 1 n= ? 1 0 n= 10 ? 4 1 1 n= ? erc 0 0 n= 10 ? 4 0 1 n= ? 1 0 n= ? 1 1 n= ? hirc 0 0 n= 10 ? 4 0 1 n= ? 1 0 n= ? 1 1 n= ? required wake-up clock cycles haltc register bit 7 6 5 4 3 2 1 0 name oscon lcdon r/w r/w r/w por 0 0 bit 7 oscon : system oscillator state in the power down mode 0: system oscillator stops running 1: system oscillator keeps running bit 6~1 unimplemented, read as 0 bit 0 lcdon : lcd module state in the power down mode 0: lcd state is determined by the lcd_on confguration option 1: lcd module remains on (if the f is active) regardless of the confguration option setting
rev. 1.40 36 ? a ??? 1 ?? ? 01 ? rev. 1.40 37 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale reset and initialisation a reset function is a fundamental part of any microcontroller ensuring that the device can be set to some predetermined condition irrespective of outside parameters. the most important reset condition is after power is frst applied to the microcontroller . in this case, internal circuitry will ensure that the microcontroller , after a short delay , will be in a well defned state and ready to execute the frst program instruction. after this power -on reset, certain important internal registers will be set to defned states before the program commences. one of these registers is the program counter, which will be reset to zero forcing the microcontroller to begi n progra m e xecution from t he l owest program me mory a ddress. in a ddition t o t he powe r- on reset, situations may arise where it is necessary to forcefully apply a reset condition when the microcontroller i s running. one exam ple of t his is where afte r power has been appli ed and the microcontroller is already running, the res line is forcefully pulled low . in such a case, known as a n ormal o peration r eset, so me o f t he m icrocontroller r egisters r emain u nchanged a llowing t he microcontroller to proceed with normal operation after the reset line is allowed to return high. another type of reset is w hen the watchdog t imer overflow s and resets the microcontroller . a ll types of reset operations result in dif ferent register conditions being setup. another reset exists in the form of a low v oltage reset, l vr, where a full reset, similar to the res reset is implemented in situations where the power supply voltage falls below a certain threshold. reset functions there are five w ays in w hich a microcontroller res et can occur , through events occurring both internally and externally: power-on reset the m ost fund amental a nd una voidable re set i s t he one t hat oc curs a fter powe r i s frst a pplied t o the microcontroller . as well as ensuring that the program memory begins execution from the frst memory address, a pow er-on reset als o ensures that certain other registers are preset to known conditions. all the i/o port and port control registers will power up in a high condition ensuring that all pins will be frst set to inputs.                        1rwh  w 567'  lv  srzhurq  ghod\  w\slfdo  wlph pv power-on reset timing chart for the applicatio n a resistor connected between vdd and the res pin and a capacitor connected between vss and the res pin will provide a suitable externa l reset circuit. any wiring connecte d to the res pin should be kept as short as possible to minimise any stray noise interference. for the application that operate s within an environment where more noise is present the enhanced reset circuit shown is recommended.
rev. 1.40 36 ?a??? 1?? ?01? rev. 1.40 37 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale                            note: * it is recommended that this component is added esd protection. ** it is recommended that this component is added in environments where power line noise is signifcant. external res circuit more information regarding external reset circuits is located in application note ha0075e on the holtek website res pin reset this type of reset occurs when the microcontroller is already running and the res pin is forcefully pulled low by exte rnal hardware such as an external switch. in this case as in the case of other reset, the program counter will reset to zero and program execution initiated from this point.                      1rwh  w 567'  lv  srzhurq  ghod\  w\slfdo  wlph  pv res reset timing chart low voltage reset C lvr the mi crocontroller cont ains a low volt age reset circui t in orde r to moni tor the supply volt age of the devic e . the l vr function has a specifc l vr voltage v lvr . if the supply voltage of the device drops to within a range of 0.9v~v lvr such as might occur when changing the battery , the l vr will automatically r eset t he d evice i nternally and t he l vrf b it i n t he w dtc1 r egister wi ll a lso b e se t to 1 . t he l vr i ncludes t he fol lowing spe cifcations: for a va lid l vr si gnal, a l ow vol tage, i .e., a voltage in the range between 0.9v~v lvr must exist for greater than the value t lvr specifed in the a.c. characteristics. if the low voltage state does not exceed t lvr , the l vr will ignore it and will not perform a reset function. one of a range of specifed voltage value s for v lvr can be selected by the l vs bits in the l vrc register . if the l vs7~lvs0 bits have any other value, which may perhaps occur due to adverse environmental conditions such as noise, the l vr will reset the device after 2~3 lirc clock cycles . w hen this happens, the lrf bit in the wd tc1 register w ill be set to 1. after power on the register will have the value of 01010101b. note that the l vr function will be automatically disabled when the device enters the power down mode.                 1rwh  w 567'  lv  srzhurq  ghod\  w\slfdo  wlph  pv low voltage reset timing chart
rev. 1.40 38 ? a ??? 1 ?? ? 01 ? rev. 1.40 39 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ? lvrc register bit 7 6 5 4 3 2 1 0 name lvs7 lvs6 lvs ? lvs4 lvs3 lvs ? lvs1 lvs0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 1 0 1 0 1 0 1 bit 7~0 : lvr voltage select 01010101: 2.1v (default) 00110011: 2.55v 10011001: 3.15v 10101010: 3.8v other values: generates mcu reset C register is reset to por value when an actual low voltage condit ion occurs, as specifed by one of the four defned lvr voltage values above, an mcu reset will be generated. the reset operation will be activated after 2~3 lirc clock cycles . in this s ituation the regis ter contents w ill remain the same after such a reset occurs. any register value, other than the four defned register values above, will also result in the generation of an mcu reset. the reset operation will be activated after 2~3 lirc clock cycles. however in this situation the register contents will be reset to the por value. watchdog time-out reset during normal operation the w atchdog t ime-out re set duri ng norm al opera tion i s t he sam e a s a ha rdware res pi n re set except that the w atchdog time-out fag t o will be set to 1.                   1rwh  w 567'  lv  srzhurq  ghod\  w\slfdo  wlph  pv wdt time-out reset during normal operation timing chart watchdog time-out reset during power down mode the w atchdog tim e-out reset during power down mode is a little dif ferent from other kinds of reset. most of the conditions remain unchanged except that the program counter and the stack pointer will be c leared t o 0 a nd t he t o fa g wi ll be se t t o 1 . re fer t o t he a.c. cha racteristics for t sst details.                1rwh  7kh  w 667  fdq  eh  fkrvhq  wr  eh  hlwkhu    ru    forfn  f\fohv  yld  frq?jxudwlrq  rswlrq  li  wkh  v\vwhp  forfn  vrxufh  lv  surylghg  e\  (5&  ru  +,5&  7kh  667  lv    iru  +;7  ru  /;7 wdt time-out reset during power down timing chart reset initial conditions the dif ferent types of reset described af fect the reset fags in dif ferent ways. these fags, known as pdf and t o are located in the status register and are controlled by various microcontroller operations, such as the power down function or w atchdog t imer. the reset fags are shown in the table .
rev. 1.40 38 ?a??? 1?? ?01? rev. 1.40 39 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale to pdf reset conditions 0 0 p owe ? -on ? eset u u res o ? lvr ? eset du ? ing n o ? mal ope ? ation 0 1 res wake-up halt 1 u wdt time-out ? eset du ? ing no ? mal ope ? ation 1 1 wdt wake-up halt note: u stands for unchanged. the following table indicates the way in which the various components of the microcontroller are affected after a power-on reset occurs. item condition after reset p ? og ? am counte ? reset to ze ? o inte ?? upts all inte ?? upts will be disabled wdt clea ? afte ? ? eset ? wdt begins ? ounting time ? /event counte ? time ? counte ? will be tu ? ned off p ? es ? ale ? t ? e time ? counte ? p ? es ? ale ? will be ? lea ? ed input/output po ? ts i/o po ? ts will be setup as inputs sta ? k pointe ? sta ? k pointe ? will point to t ? e top of t ? e sta ? k the dif ferent kinds of resets all af fect the internal registers of the micr ocontroller in dif ferent ways. to ensure reliable continuation of normal program execution after a reset occurs, it is important to know what condition the microcontroller is in after a particular reset occurs. the following table describes how each type of reset affects each of the microcontroller internal registers. register reset (power on) wdt time-out (normal operation) res reset (normal operation) res reset (halt) wdt time-out (halt)* iar0 ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ? p0 xxxx xxxx uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu iar1 ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ? p1 xxxx xxxx uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu bp ---0 --00 ---0 --00 ---0 --00 ---0 --00 ---u --uu acc xxxx xxxx uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu pcl ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- tblp xxxx xxxx uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu tblh xxxx xxxx uuuu uuuu uuuu uuuu uuuu uuuu uuuu uuuu ctrl0 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu status --00 xxxx --1u uuuu --uu uuuu --01 uuuu --11 uuuu intc0 -000 0000 -000 0000 -000 0000 -000 0000 -uuu uuuu lvrc 0101 0101 0101 0101 0101 0101 0101 0101 uuuu uuuu t ? r0 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx uuuu uuuu t ? r0c 0000 1000 0000 1000 0000 1000 0000 1000 uuuu uuuu t ? r1h xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx uuuu uuuu t ? r1l xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx uuuu uuuu t ? r1c 0000 1000 0000 1000 0000 1000 0000 1000 uuuu uuuu pa 1111 1111 1111 1111 1111 1111 1111 1111 uuuu uuuu pac 1111 1111 1111 1111 1111 1111 1111 1111 uuuu uuuu pb --11 1111 --11 1111 --11 1111 --11 1111 --uu uuuu pbc --11 1111 --11 1111 --11 1111 --11 1111 --uu uuuu
rev. 1.40 40 ? a ??? 1 ?? ? 01 ? rev. 1.40 41 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale register reset (power on) wdt time-out (normal operation) res reset (normal operation) res reset (halt) wdt time-out (halt)* daco --00 0000 --00 0000 --00 0000 --00 0000 --uu uuuu ftrc 0--0 --00 0--0 --00 0--0 --00 0--0 --00 u--u --uu adcr -000 x000 -000 x000 -000 x000 -000 x000 -uuu uuuu swc 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu adcd 0000 -111 0000 -111 0000 -111 0000 -111 uuuu -uuu wdtc1 0101 0x11 0101 0x11 0101 0x11 0101 0x11 uuuu uuuu wdtc 111- ss01 111- ss01 111- ss01 111- ss01 uuu- uuuu wdtd 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu intc1 -000 -000 -000 -000 -000 -000 -000 -000 -uuu Cuuu chprc 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu t ? r ? h xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx uuuu uuuu t ? r ? l xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx uuuu uuuu t ? r ? c 0000 1000 0000 1000 0000 1000 0000 1000 uuuu uuuu sgc 0--0 ---- 0--0 ---- 0--0 ---- 0--0 ---- u--u ---- sgdnr ---0 0000 ---0 0000 ---0 0000 ---0 0000 ---u uuuu sgn --00 0000 --00 0000 --00 0000 --00 0000 --uu uuuu haltc 0--- ---0 0--- ---0 0--- ---0 0--- ---0 u--- ---u lcdout 1111 1111 1111 1111 1111 1111 1111 1111 uuuu uuuu ctrl1 00-- --01 00-- --01 00-- --01 00-- --01 uu-- --uu vibrc ---- ---0 ---- ---0 ---- ---0 ---- ---0 ---- ---u iadac 0-00 0000 0-00 0000 0-00 0000 0-00 0000 u-uu uuuu pc 1111 1111 1111 1111 1111 1111 1111 1111 uuuu uuuu pcc 1111 1111 1111 1111 1111 1111 1111 1111 uuuu uuuu pawk 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu papu -000 0000 -000 0000 -000 0000 -000 0000 -uuu uuuu pbpu --00 0000 --00 0000 --00 0000 --00 0000 --uu uuuu pcpu 1111 1111 1111 1111 1111 1111 1111 1111 uuuu uuuu sfs ---- --00 ---- --00 ---- --00 ---- --00 ---- --uu opac 0--- 0000 0--- 0000 0--- 0000 0--- 0000 u--- uuuu lcdc 00-0 -000 00-0 -000 00-0 -000 00-0 -000 u u-u -uuu ? fic -000 -000 -000 -000 -000 -000 -000 -000 -uuu -uuu iac0 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu iac1 1111 00-1 1111 00-1 1111 00-1 1111 00-1 uuuu uu-u tk ? 0c4 -000 ---0 -000 ---0 -000 ---0 -000 ---0 -uuu ---u tk ? 016dh 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu tk ? 016dl 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu tk ? 010dl 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu tk ? 0ro 0000 0001 0000 0001 0000 0001 0000 0001 uuuu uuuu tk ? 0c0 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu tk ? 0c1 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu tk ? 0c ? 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu tk ? 0c3 0000 0000 0000 0000 0000 0000 0000 0000 uuuu uuuu note : *stands for warm reset "-" not implement "u" stands for "unchanged" "x" stands for "unknown" "s" for special case, it depends on the option table (please see the wdt chapter for the detail)
rev. 1.40 40 ?a??? 1?? ?01? rev. 1.40 41 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale input/output ports holtek m icrocontrollers o ffer c onsiderable fe xibility o n t heir i /o p orts. mo st p ins c an h ave e ither a n input or output designation under user program control. additionally , as there are pull-high resistors and wake-up software confgurations, the user is provided with an i/o structure to meet the needs of a wide range of application possibilities. for input operation, these ports are non-latching, which means the inputs must be ready at the t2 rising edge of instruction "mov a, [m]", where m denotes the port address. for output operation, all the data is latched and remains unchanged until the output latch is rewritten. i/o register list register name por bit 7 6 5 4 3 2 1 0 pawk 00h pawk7 pawk6 pawk ? pawk4 pawk3 pawk ? pawk1 pawk0 pac ffh pac7 pac6 pac ? pac4 pac3 pac ? pac1 pac0 papu 00h papu6 papu ? papu4 papu3 papu ? papu1 papu0 pbc 3fh pbc ? pbc4 pbc3 pbc ? pbc1 pbc0 pbpu 00h pbpu ? pbpu4 pbpu3 pbpu ? pbpu1 pbpu0 pcc ffh pcc7 pcc6 pcc ? pcc4 pcc3 pcc ? pcc1 pcc0 pcpu ffh pcpu7 pcpu6 pcpu ? pcpu4 pcpu3 pcpu ? pcpu1 pcpu0 pull-high resistors many product applications require pull-high resistors for their switch inputs usually requiring the use of an external resistor . t o eliminate the need for these external resistors, when confgured as an input have the capability of being connected to an internal pull-high resistor . these pull-high resistors are selectable via a register known as papu, pbpu and pcpu located in the data memory. the pull-high resistors are implemented using weak pmos transistors. note that pin p a7 does not have a pull-high resistor selection. papu register bit 7 6 5 4 3 2 1 0 name papu6 papu ? papu4 papu3 papu ? papu1 papu0 r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 bit 7 unimplemented, read as 0 bit 6~0 papu : i/o port bit 6 ~ bit 0 pull-high control 0: disable 1: enable pbpu register bit 7 6 5 4 3 2 1 0 name pbpu ? pbpu4 pbpu3 pbpu ? pbpu1 pbpu0 r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 bit 7~6 unimplemented, read as 0 bit 5~0 pbpu : i/o port bit 5 ~ bit 0 pull-high control 0: disable 1: enable
rev. 1.40 4 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 43 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale pcpu register bit 7 6 5 4 3 2 1 0 name pcpu7 pcpu6 pcpu ? pcpu4 pcpu3 pcpu ? pcpu1 pcpu0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 1 1 1 1 1 1 1 1 bit 7~0 pcpu : i/o port bit 7 ~ bit 0 pull-high control 0: disable 1: enable port a wake-up if the hal t instruction is executed, the device will enter power down mode, where the system clock will stop resulting in power being conserved, a feature that is important for battery and other low-power applications. v arious methods exist to wake-up the microcontroller , one of which is to change the logic condition on one of the p a0~pa7 pins from high to low . after a hal t instruction forces the microcontroller into entering power down mode, the processor will remain in a low-power state until the logic condition of the selected wake-up pin on port a changes from high to low . this function is especia lly suitable for applications that can be woken up via external switches. note that pins p a0 to p a7 can be selected individually to have this wake-up feature using an internal register known as pawk, located in the data memory. pawu register bit 7 6 5 4 3 2 1 0 name pawk7 pawk6 pawk ? pawk4 pawk3 pawk ? pawk1 pawk0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7~0 paw u : port a bit 7 ~ bit 0 w ake-up control 0: disable 1: enable i/o port control registers each port has its own control register , known as p ac, pbc and pcc which controls the input/ output configuration. w ith this control register , each i/o pin with or without pull-high resistors can be reconfigured dynamically under software control. for the i/o pin to function as an input, the corresponding bit of the control register must be written as a 1 . this will then allow the logic state of the input pin to be directl y read by instructions. when the corresponding bit of the control regi ster is written as a 0 , the i/o pin will be setup as a cmos output. if the pin is currently setup as an output, instructions can still be used to read the output register . however , it should be noted that the program will in fact only read the status of the output data latch and not the actual logic status of the output pin. pac register bit 7 6 5 4 3 2 1 0 name pac7 pac6 pac ? pac4 pac3 pac ? pac1 pac0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 1 1 1 1 1 1 1 1 bit 7~0 pac : i/o port bit 7 ~ bit 0 input/output control 0: output 1: input
rev. 1.40 4? ?a??? 1?? ?01? rev. 1.40 43 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale pbc register bit 7 6 5 4 3 2 1 0 name pbc ? pbc4 pbc3 pbc ? pbc1 pbc0 r/w r/w r/w r/w r/w r/w r/w por 1 1 1 1 1 1 bit 7~6 unimplemented, read as 0 bit 5 ~0 : i/o port bit 5 ~ bit 0 input/output control 0: output 1: input pcc register bit 7 6 5 4 3 2 1 0 name pcc7 pcc6 pcc ? pcc4 pcc3 pcc ? pcc1 pcc0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 1 1 1 1 1 1 1 1 bit 7~0 : i/o port bit 7 ~ bit 0 input/output control 0: output 1: input pin-shared functions the fexibility of the microcontroller range is greatly enhanced by the use of pins that have more than one function. limited numbers of pins can force serious design constraints on designers but by supplying pins with multi-functions , many of these diffculties can be overcome. for some pins, the chosen fu nction o f t he m ulti-function i /o p ins i s se t b y c onfguration o ptions wh ile f or o thers t he function is set by application program control. external interrupt input the exter nal inter rupt pin, int , is pin-shared with an i/o pin. t o use the pin as an external interrupt input the correct bits in the intc0 register must be programmed. the pin must also be setup as an input by setting the pbc4 bit in the port control register . a pull-high resistor can also be selected via the appropriate port pull-high resistor register . note that even if the pin is setup as an external interrupt input the i/o function still remains. external timer/event counter input the t imer/event counter pins, tmr 0, tmr 1 and tmr 2 are pin-shared with i/o pins. for these shared pins to be used as t imer/event counter inputs, the t imer/event counter must be confgured to be in the event counter or pulse w idth measurement mode. this is achieved by setting the appropriate bits in the t imer/event counter control register . the pins must also be setup as inputs by setting the appropriate bit in the port control register . pull-high resistor options can also be selected using the port pull-high resistor registers. note that even if the pin is setup as an external timer input the i/o function still remains. buzzer output the buzzer functi on output is pin-shared with an i/o pin. the output function of this pin is chosen using the sfs register . note that the corresponding bit of the port control register , must setup the pin as an output to enable buzzer output. if the port control register has s etup the pin as an input, then the pin will function as a normal logic input with the usual pull-high selection, even if buzzer function has been selected.
rev. 1.40 44 ? a ??? 1 ?? ? 01 ? rev. 1.40 4? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale lcd driver pins pins p c0~pc7 on port c can be used as lcd seg driver pins. this function is controlled using the lcdout register. touch key pins pins pb0~pb3 are pin-shared with touch key function. this function is controlled using the tkm0c2 register . i/o pin structures the diagrams illustrate the i/o pin internal structures. as the exact logical construction of the i/o pin may dif fer from these drawings, they are supplied as a guide only to assist with the functional understanding of the i/o pins.                        
     ??? ?  ?    ?-
?     ? ?? ?? ? ?-    ? 
? -  ? ?? ?? ?  ?-
? 
  ? ?? ? ?? ?  ?-
? ? -     ?-
?   ? -        ?  ?  ?   ?  ?  ?  ? ? ? ? ? ? ?  ?  ?  ? ? ? ? ? ? ?  ? ? ??  ??  ? ?? ?  ? ?? ? generic input/output ports              
          
          
                                     ?? ?  ?   ?   
 pa7 nmos input/output port
rev. 1.40 44 ?a??? 1?? ?01? rev. 1.40 4 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale programming considerations within the user program, one of the frst things to consider is port initi alisation. after a reset, the i/ o data register and i/o port control register will be set high. this mean s that all i/o pins will default to an input state, the level of which depends on the other connected circuitry and whether pull-high options have been selected. if the port control regis ters, are then programmed to setup some pins as outputs, these output pins will have an initial high output value unless the associated port data register is frst programmed. selecti ng which pins are inputs and which are outputs can be achieved byte-wide by loading the correct value into the port control register or by programming individual bits in the port control register using the set [m].i and clr [m].i instructions. note that when using these bit control instructions, a read-modify-write operation takes place. the microcontroller must frst read in the data on the entire port, modify it to the required new bit values and then rewrite this data back to the output ports.                  
              read modify write timing pins p a0 to p a7 each have a wake-up function, selected via the p awk register . when the device is in the idle/sleep mode, various methods are available to wake the device up. one of these is a high to low t ransition o f a ny o f t hese p ins. si ngle o r m ultiple p ins o n po rt a c an b e se tup t o h ave t his f unction. timer/event counter s three tim er/event counters are impl emented in the microcontroller . t imer/event counter 0 contains an 8-bit programmable count-up counter whose clock may come from an external source or an internal clock source. an internal clock source comes from f sys or the internal low frequency clock known as fl. t imer/event counter 1 contains a 16-bit programmable count-up counter whose clock may come from an external source or an internal clock source. an internal clock source comes from f sys /4 or the internal low frequency clock known as fl. the clock fl is derived from the lirc or lxt oscill ator and can be sel ected by the low frequency sele ction bit lfs bit in the ctrl0 register. the external clock input allows the user to count external events, measure time intervals or pulse widths, or to generate an accurate time base. t imer/event counter 2 contains a 16-bit programmable count-up counter whose clock may come from an extern al source or an internal clock source. an interna l clock source comes from f sys /4 or the t imer/event counter 2 internal clock f tck . the clock f tck may come from the low frequency clock f l or the clocks generated from the t ouch key module named f ref , fsen and f tmck described in the t ouch key function section. the clock is selected using the t imer/event counter 2 clock source selection bits tcks1 and tck0 in the ctrl0 register . the external clock input allows the user to count external events, measure time intervals or pulse widths, or to generate an accurate time base. there are two registers related to the t imer/event counter 0; tmr0 and tmr0c.w riting to tmr0 puts the starting value in the t imer/event counter 0 register and reading tmr0 reads out the contents of t imer/event counter 0. the tmr0c is a timer/event counter control register , which defines t he o verall o perations. t here a re t hree r egisters r elated t o t he t imer/event c ounter 1 ; tmr1h, t mr1l a nd t mr1c. w riting t o t mr1l wi ll onl y put t he wri tten da ta i nto a n i nternal lower-order byt e buf fer (8-bit) while writi ng to tmr1h wil l transfe r the specifi ed data and the contents of the lower -order byte buf fer to both the tmr1h and tmr1l registers, respectively .
rev. 1.40 46 ? a ??? 1 ?? ? 01 ? rev. 1.40 47 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale the t imer/event counter 1 preload register is changed when each time there is a write operation to tmr1h. reading tmr1h will latch the contents of tmr1h and tmr1l counters to the destination and the lower -order byte buf fer, respectively . reading tmr1l will read the contents of the lower -order byte buf fer. tmr1c is the t imer/event counter 1 control register , which defnes the operating mode, counting enable or disable, the tmr1 active edge and the prescaler stage selections. also there are three registers related to the t imer/event counter 2 named tmr2h, tmr2l and tmr2c. the operations of reading from and writing to the t imer/event counter 2 registers named tmr2h and tmr2l are the same with t imer/event counter 1 described above. the txm0 and txm1 bits in tmrxc register where x may be equal to 0, 1 or 2 defne the operation mode. t he e vent c ount m ode i s u sed t o c ount e xternal e vents, wh ich m eans t hat t he c lock so urce must come from the external (tmr0, tmr1 or tmr2) pin. the timer mode functions as a normal timer with the clock source coming from the internal selected clock source. finally, the pulse width measureme nt mode can be used to count a high or low level duration of an external signal on the tmr0, tmr1 or tmr2 pins with the timing based on the internally selected clock source. in the event count or timer mode, the t imer/event counter starts counting at the current contents in the t imer/event counter and ends at ffh for -8-bit counter or ffffh for 16- bit counter . once an overfow occurs, the counter is reloaded from the timer/event counter preload register, and generates an interrupt request fag, t0f , t1f or t2f . in the pulse width measurement mode with the values of the t imer enable control bit txon and the active edge control bit txe equal to 1, after the tmrx pin has received a transient from low to high (or high to low if the txe bit is 0), it will start counting until the tmrx pin returns to the original level and resets the txon bit. t he m easured r esult r emains i n t he t imer/event c ounter e ven i f t he a ctivated t ransient o ccurs again. t herefore, only a 1-cycle measurement can be made until the t xon bit is again set. t he cycle measurement will re-function as long as it receives further transient pulses. in this operation mode, the timer/event counter begins counting not according to the logic level but to the transient edges. in the case of counter overfows, the counter is reloaded from the timer/event counter register and issues an interrupt request, as in the other two modes, i.e., event and timer modes.                  
        
            ?    
     ?  ? ?  ?   ? ? -  ?  ? ??      ?     ? ?  ?  ? ?  ???  ?   ? ? ?? ? ?  ? ?? ?? ? ??  ? ?????? ?? ?  ?   timer/event count 0                 
                     ? ?    ?   ?   ? ?   ?    ?      ? ? - 
?  ?   ?  ?  ? ? ?  ?? ?? ? ? ?? ?  ? ? ??? ??  ?   ? ? ? ? 
?? ?? ? ? ?  ? ?????? ? ?     ?   ?       7lphu(yhqw&rxqw
rev. 1.40 46 ?a??? 1?? ?01? rev. 1.40 47 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale                  
       
  
        ?   ?   ?     ?  ?    ?       ? ? -   ?  ?   - ?? ? ? ?? ?? ? ?? ?? ? ? ? ?  ???  ? ? ?  ? ? ? ? ? ?  ? ? ?? ? ? ?  ? ????-? ? ? ? ? ? ? ?? ? ?? ?   ? ?  ???  ? ??  ? ? ? ? ? ? ? ? ? ?? ?  ?     ? ? timer/event count 2              tmr0c register bit 7 6 5 4 3 2 1 0 name t0 ? 1 t0 ? 0 t0s t0on t0e t0psc ? t0psc1 t0psc0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 1 0 0 0 bit 7~6 t0m1, t0m0 : t imer0 operation mode selection 00: no mode available 01: event counter mode 10: timer mode 11: pulse width measurement mode bit 5 t0s : timer clock source 0: f 1: low frequency clock f l bit 4 t0on : t imer/event counter counting enable 0: disable 1: enable bit 3 t0e: event counter active edge selection 0: count on rising edge 1: count on falling edge pulse w idth measurement active edge selection 0: start counting on falling edge, stop on rising edge 1: start counting on rising edge, stop on falling edge bit 2~0 t0psc2, t0psc1, t0psc0 : t imer prescaler rate selection timer internal clock (f int0 )= 000: f t0 001: f t0 /2 010: t0 /4 011: t0 /8 100: t0 /16 101: t0 /32 110: t0 /64 111: t0 /128
rev. 1.40 48 ? a ??? 1 ?? ? 01 ? rev. 1.40 49 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale tmr 1c register bit 7 6 5 4 3 2 1 0 name t1 ? 1 t1 ? 0 t1s t1on t1e t1 psc ? t1psc1 t1psc0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 1 0 0 0 bit 7~6 t1m1, t1m0 : t imer0 operation mode selection 00: no mode available 01: event counter mode 10: timer mode 11: pulse width measurement mode bit 5 t1s : timer clock source 0: f /4 1: low frequency clock f l bit 4 t1on : t imer/event counter counting enable 0: disable 1: enable bit 3 t1e: event counter active edge selection 0: count on rising edge 1: count on falling edge pulse w idth measurement active edge selection 0: start counting on falling edge, stop on rising edge 1: start counting on rising edge, stop on falling edge bit 2~0 t1psc2, t1psc1, t1psc0 : t imer prescaler rate selection timer internal clock (f int1 )= 000: f t1 001: f t1 /2 010: t1 /4 011: t1 /8 100: t1 /16 101: t1 /32 110: t1 /64 111: t1 /128
rev. 1.40 48 ?a??? 1?? ?01? rev. 1.40 49 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale tmr2c register bit 7 6 5 4 3 2 1 0 name t ?? 1 t ?? 0 t ? s t ? on t ? e t ? psc ? t ? psc1 t ? psc0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 1 0 0 0 bit 7~6 t2m1, t2m0 : t imer0 operation mode selection 00: no mode available 01: event counter mode 10: timer mode 11: pulse width measurement mode bit 5 t2s : t imer clock source 0: f /4 1: f tck bit 4 t2on : t imer/event counter counting enable 0: disable 1: enable bit 3 t2e: event counter active edge selection 0: count on rising edge 1: count on falling edge pulse w idth measurement active edge selection 0: start counting on falling edge, stop on rising edge 1: start counting on rising edge, stop on falling edge bit 2~0 t2psc2, t2psc1, t2psc0 : t imer prescaler rate selection timer internal clock (f int2 )= 000: f t2 001: f t2 /2 010: t2 /4 011: t2 /8 100: t2 /16 101: t2 /32 110: t2 /64 111: t2 /128
rev. 1.40 ? 0 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?1 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale timer mode in this mode, the t imer/event counter can be utilised to measure fxed time intervals, providing an internal interru pt signal each time the t imer/event counter overfows. t o operate in this mode, the operating mode select bit pair , tnm1/tnm0, in the t imer control register must be set to the correct value as shown. control register operating mode select bits for the timer mode bit7 bit6 1 0 in this mode the internal clock is used as the timer clock. the timer input clock source is either f sys , f sys /4, f l or f tck . however , this timer clock source is further divide d by a prescaler , the value of which is determin ed by the bits tnpsc2~tnpsc0 in the t imer control register . the timer -on bit, tnon must be set high to enable the timer to run. each time an internal clock high to low transition occurs, the timer increments by one; when the timer is full and overflows, an interrupt signal is generated and the timer will reload the value already loaded into the preload register and continue counting. a timer overflow condition and corresponding internal interrupt is one of the wake-up sources, however , the internal interr upts can be disabled by ensuring that the etni bits of the intc0 and mfic register are reset to zero.                           
      timer mode timing chart event counter mode in this mode, a number of externall y changing logic events, occurring on the external timer tmrn pin, can be recorded by the t imer/event counter . t o operate in this mode, the operating mode select bit pair , tnm1/tnm0, in the t imer control register must be set to the correct value as shown. control register operating mode select bits for the event counter mode bit7 bit6 0 1 in this mode, the external timer tm rn pin is us ed as the t imer/event counter clock s ource, however it is not divided by the inte rnal prescaler . after the other bits in the t imer control register have been setup, the enable bit tnon, which is bit 4 of the t imer control register , can be set high to enable the t imer/event counter to run. if the active edge select bit, tne, which is bit 3 of the timer control register , is low , the t imer/event counter will increment each time the external timer pin receives a low to high transition. if the tne is high, the counter will increment each time the external timer pin receives a high to low transition. when it is full and overfows, an interrupt signal is ge nerated a nd t he t imer/event count er wi ll re load t he va lue a lready l oaded i nto t he pre load register and continue counting. the interrupt can be disabled by ensuring that the t imer/event counter interrupt enable bit in the corresponding interrupt control register is reset to zero. as the external tim er pin is shared with an i/o pin, to ensure that the pin is confgured to operate as an event counter input pin, two things have to happen. the frst is to ensure that the operating mode select bit s in the t imer cont rol register pla ce t he t imer/event count er in the event count ing
rev. 1.40 ?0 ?a??? 1?? ?01? rev. 1.40 ? 1 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale mode, the second is to ensure that the port control register confgures the pin as an input. it should be noted that in the event counting mode, even if the is in the power down mode, the t imer/event counter will conti nue to record externally changing logic events on the timer input tmrn pin. as a result when the timer overfows it will generate a timer interrupt and corresponding wake-up source.                               event counter mode timing chart (t ne=1) pulse width measurement mode in this mode, the t imer/event counter can be utilised to measure the width of external pulses applied to the external timer pin. t o operate in this mode, the operating mode select bit pair, tnm1/ tnm0, in the t imer control register must be set to the correct value as shown. control register operating mode select bits for the pulse w idth capture mode bit7 bit6 1 1 i n this mode the internal clock, f sys , f sys /4, f l or f tck , is used as the internal clock for the 8-bit timer/event counter and the 16-bit t imer/event counter . however , the clock source, f sys and f sys /4, for the 8-bit timer and the 16-bit timer are further divided by a prescaler , the value of which is determ ined by the prescaler rate select bits tnpsc2~tnpsc0, which are bits 2~0 in the t imer control r egister. aft er t he o ther b its i n t he t imer c ontrol r egister h ave b een se tup, t he e nable bit tnon, which is bit 4 of the t imer control register , can be set high to enable the t imer/event counter, however it will not actually start counting until an active edge is received on the external timer pin. if the active edge select bit tne, which is bit 3 of the t imer control register , is low , once a high to l ow t ransition ha s be en re ceived on t he e xternal t imer pi n, t he t imer/event count er wi ll st art counting until the external timer pin returns to its original high level. at this point the enable bit will be automatically reset to zero and the t imer/event counter will stop counting. if the active edge select bi t is high, the t imer/event counter will begin counting once a low to hi gh transit ion has been rece ived on the external timer pin and stop counting when the external timer pin returns to its original low level . as before, the enable bit will be automatically reset to zero and the t imer/event counter will stop counting. it is important to note that in the pulse width measurement mode, the enable b it i s a utomatically r eset t o z ero wh en t he e xternal c ontrol si gnal o n t he e xternal t imer p in returns to its original level, whereas in the other two modes the enable bit can only be reset to zero under program control. the residual value in the t imer/event counter , which can now be read by the program, there fore represents the length of the pulse received on the tmrn pin. as the enable bit has now been reset, any further transitions on the external timer pin will be ignored. the timer cannot begin further pulse width measurement until the enable bit is set high again by the program. in this way, single shot pulse measurements can be easily made. it should be noted that in this mode the t imer/event counter is controlled by logical transitions on t he e xternal t imer p in a nd n ot b y t he l ogic l evel. w hen t he t imer/event c ounter i s f ull a nd overfows, an interrupt signal is generated and the t imer/event counter will reload the value already loaded into the preload register and continue counting. the interrupt can be disabled by ensuring that the t imer/event counter interrupt enable bit in the corresponding interrupt control register , is reset to zero.
rev. 1.40 ?? ? a ??? 1 ?? ? 01 ? rev. 1.40 ?3 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale as the tmrn pin is shared with an i/o pin, to ensure that the pin is configured to operate as a pulse width measurement pin, two things have to happen. the frst is to ensure that the operating mode select bits in the t imer control register place the t imer/event counter in the pulse width measurement mode, the second is to ensure that the port control register confgures the pin as an input.                    
                             ?? ?  ?? ?  ?  pulse width measurement mode timing chart (t ne=0) prescaler bits tnpsc0~tnpsc2 of the tmrnc register can be used to defne a division ratio for the internal clock source of the t imer/event counter enabling longer time out periods to be setup. buzzer operating in a similar way to the programmable frequency divider , the buzzer function provides a means o f p roducing a v ariable f requency o utput, su itable f or a pplications su ch a s pi ezo-buzzer driving or other external circuits that require a precise frequency generator . the bz and bz pins form a complimentary pair , and are pin-s hared w ith i/o pins, p a 1 and p a 2 . n ote that the bz pin is the inverse of the bz pin which together generate s a dif ferential output which can supply more power to connected interfaces such as buzzers. the pa1 and pa2 are setup as i/o pins or buzzer pins using the sfs register . the buzzer is driven by the t imer/event counter 0 or t imer/event counter 1 overflow signal divided by 2 selected by the clock source selection bit named bzcs in ctrl1 register. if the software options have selected both pins p a1 and p a2 to function as a bz and bz complementary pair of buzzer outputs, then for correct buzzer operatio n it is essential that both pins must be set up a s out puts by set ting bi ts p ac1 a nd p ac2 of t he p ac port c ontrol re gister t o z ero. the pa1 data bit in the pa data register must also be set high to enable the buzzer outputs, if set low, both pins p a1 and p a2 will remain low . in this way the single bit p a1 of the p a data register can be used as an on/of f control for both the bz and bz buzzer pin outputs. note that the p a2 data bit in the pa data register has no control over the bz buzzer pin pa2. if software options have selected that only the p a1 pin is to function as a bz buzzer pin, then the pa2 pin can be used as a normal i/o pin. for the p a1 pin to function as a bz buzzer pin, p a1 must be s etup as an output by s etting bit p ac1 of the p ac port control regis ter to zero. the p a1 data bit in the p a data register must also be set high to enable the buzzer output, if set low pin p a1 will remain low . in this way the p a1 bit can be used as an on/of f control for the bz buzzer pin p a1. if the p ac1 bit of the p ac port control register is set high, then pin p a1 can still be used as an input even though the software option has confgured it as a bz buzzer output.
rev. 1.40 ?? ?a??? 1?? ?01? rev. 1.40 ? 3 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale bzbs bzs pac 2 pa c1 pa 2 pa 1 function 1 1 0 0 x 1 pa1= bz ? pa ? = bz 1 1 0 0 x 0 pa1= "0" ? pa ? = "0" 1 1 0 1 x 1 pa1= "input" ? pa ? = bz 1 1 0 1 x 0 pa1= "input" ? pa ? = "0" 1 1 1 0 x 1 pa1= bz ? pa ? = "input" 1 1 1 0 x 0 pa1= "0" ? pa ? = "input" x x 1 1 x x pa1= "input" ? pa ? = "input" 0 0 x x x x pa1= "i/o" ? pa ? = "i/o" "" stands fo ? don t ? a ? e sfs register bit 7 6 5 4 3 2 1 0 name bzbs bzs r/w r/w r/w por 0 0 bit 7~2 unimplemented, read as 0 bit 1 bzbs : pa2 function selection 0: i/o 1: bz bit 0 bzs : pa1 function selection 0: i/o 1: bz when register sfs select s the i/o function, the related control refers to the port a control register.              
                buzzer output pin control
rev. 1.40 ? 4 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale i/o interfacing the t imer/event counter , when confgured to run in the event counter or pulse width measurement mode, requires the use of an extern al timer pin for its operation. as this pin is a shared pin it must be confgured correctly to ensure that it is setup for use as a t imer/event counter input pin. this is achieved by ens uring that the mode s elect bits in the t imer/event counter control register , s elect either the event counter or pulse width measurement mode. additionally the corresponding port control regist er bi t must be set high to ensure that the pi n is setup as an input. any pull-hi gh resistor connected to this pin w ill remain valid even if the pin is used as a t imer/event counter input. programming considerations when c onfigured t o run i n t he t imer m ode, t he i nternal syst em c lock i s use d a s t he t imer c lock source and is therefore synchronised with the overall operation of the microcontroller . in this mode when the appropriate timer register is full, the microcontroller will generate an internal interrupt signal directing the program flow to the respective internal interrupt vector . for the pulse width measurement mode, the internal system clock is also used as the timer clock source but the timer will only run when the correct logic condition appears on the external timer input pin. as this is an external event and not synchronised with the internal timer clock, the microcontroller will only see this external event when the next timer clock pulse arrives. as a result, there may be small differences in measured values requiring programmers to take this into account during programming. the same applies if the timer is configured to be in the event counting mode, which again is an external event and not synchronised with the internal system or timer clock. when t he t imer/event c ounter i s r ead, o r i f d ata i s wr itten t o t he p reload r egister, t he c lock i s inhibited to avoid errors, however as this may result in a counting error , this should be taken into account by t he progra mmer. ca re m ust be t aken t o e nsure t hat t he t imers a re prope rly i nitialised before using them for the first time. the associated timer enable bits in the interrupt control register must be properly set otherwise the internal interrupt associated with the timer will remain inactive. t he e dge se lect, t imer m ode a nd c lock so urce c ontrol b its i n t imer c ontrol r egister m ust also be c orrectly se t t o e nsure t he t imer i s prope rly c onfigured for t he re quired a pplication. it i s also important to ensure that an initial value is frst loaded into the timer registers before the timer is switched on; this is because after power -on the initial values of the timer registers are unknown. after the timer has been initialised the timer can be turned on and of f by controlling the enable bit in the timer control register. when t he t imer/event c ounter o verfows, i ts c orresponding i nterrupt r equest fa g i n t he i nterrupt control register will be set. if the t imer/event counter interrupt is enabled this will in turn generate an interrupt signal. however irrespective of whether the interrupts are enabled or not, a t imer/event counter ove rfow wi ll a lso ge nerate a wa ke-up si gnal i f t he de vice i s i n a powe r-down c ondition. this si tuation m ay o ccur i f t he t imer/event c ounter i s i n t he e vent c ounting mo de a nd i f t he external signal continues to change state. in such a case, the t imer/event counter will continue to count these external events and if an overfow occurs the device will be woken up from its power - down condition. t o prevent such a wake-up from occurring, the timer interrupt request fag should frst be set high before issuing the halt instruction to enter the idle/sleep mode.
rev. 1.40 ?4 ?a??? 1?? ?01? rev. 1.40 ?? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale timer program example the program shows how the t imer/event counter registers are setup along with how the interrupts are e nabled a nd m anaged. no te h ow t he t imer/event c ounter i s t urned o n, b y se tting b it 4 o f t he timer control register . the t imer/event counter can be turned of f in a similar way by clearing the same bit. this example program sets the t imer/event counters to be in the timer mode, which uses the internal system clock as their clock source. pfd programming example o rg 04h ;external interrupt vector org 0 c h ;timer counter 0 interrupt vector jmp tmr0int ;jump here when timer 0 overfows : : o rg 20h ;main program : : ;internal timer 0 interrupt routine tmr0int: : : ;timer 0 main program placed here : : begin: ;setup timer 0 registers m ov a,09bh ;setup timer 0 preload value mov tmr0,a mov a,081h ;setup timer 0 control register mov tmr0c,a ;timer mode and prescaler set to /2 ;setup interrupt register m ov a,005 h ; enable master interrupt and both timer interrupts mov intc0,a : : s et tmr0c.4 ;start timer 0 : :
rev. 1.40 ? 6 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?7 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale vibration sensor amplifer the device contains a v ibration sensor amplifer to amplify small signal input s , generated from vibration sensors. when the sensor is connected to the vibration input pin, namely vib, and a small signal r esulting f rom v ibration d etection i s g enerated o n t he vi b p in, t he i nternal a mplifier wi ll amplify the signal to generate a wake-up source to wake up the device from the power down mode. the v ibration sensor am plifer can be enabled or disable by the control bit, vi bren, in the vi brc register to save power.             
  
       vibrc register bit 7 6 5 4 3 2 1 0 name vibren r/w r/w por 0 bit 7~1 unimplemented, read as 0 bit 0 : vibration sensor amplifer control 0: disabled 1: enabled touch key module the d evice contains f our touch k ey s . t he t ouch k ey f unction s a re f ully i ntegrated a nd require n o external components, allowing touch key functions to be implemented by the simple manipulation of internal registers. touch key structure the touch keys are pin shared with the pb logic i/o pins, with the desired function chosen via register bits. touch key register defnition the touch key functions have their own suite of registers. the following table shows the register set together with a basic description. name usage tk ? 016dh 16-bit c/f ? ounte ? ? ig ? byte tk ? 0 16dl 16-bit c/f ? ounte ? low byte tk ? 010dl 10-bit ? ounte ? low byte tk ? 0ro inte ? nal capa ? ito ? sele ? t tk ? 0c0 control register 0 key select/x2 freq/flter control/frequency select tk ? 0c1 cont ? ol registe ? 1 senso ? os ? illato ? cont ? ol/ tou ?? key o ? i/o sele ? t . tk ? 0 c ? cont ? ol registe ? ? counte ? on-off and ? lea ? ? ont ? ol/ ? efe ? en ? e ? lo ? k ? ont ? ol/ s ta ? t bit tk ? 0c3 control register 3 counter overfow bits /reference oscillator overfow time select tk ? 0c4 cont ? ol registe ? 4 f vdd clo ? k sou ?? e sele ? t/powe ? ? ont ? ol register listing
rev. 1.40 ?6 ?a??? 1?? ?01? rev. 1.40 ? 7 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale register name bits 7 6 5 4 3 2 1 0 tk ? 016dh d7 d6 d ? d4 d3 d ? d1 d0 tk ? n16dl d7 d6 d ? d4 d3 d ? d1 d0 tk ? 010dl d7 d6 d ? d4 d3 d ? d1 d0 tk ? 0ro d7 d6 d ? d4 d3 d ? d1 d0 tk ? 0c0 ? 0 ? xs1 ? 0 ? xs0 ? 0dfen ? 0filen ? 0sofc ? 0sof ? ? 0sof1 ? 0sof0 tk ? 0c1 ? 0k4oen ? 0k3oen ? 0k ? oen ? 0k1oen ? 0k4io ? 0k3io ? 0k ? io ? 0k1io tk ? 0 c ? ? 016cton ? 010cton ? 0st ? 0roen ? 0rcclr ? 016ctclr ? 010ctclr ? 0ros tk ? 0c3 d9 d8 ? 0rcov ? 016ctov ? 010ctov ? 0rovs ? ? 0rovs1 ? 0rovs0 tk ? 0c4 fvdd ? fvdd1 fvdd0 nor ? register content summary tkm016dh register bit 7 6 5 4 3 2 1 0 name d1 ? d14 d13 d1 ? d11 d10 d9 d8 r/w r r r r r r r r por 0 0 0 0 0 0 0 0 bit 7~0 d15~d8 : touch key module 16-bit counter (tmcnt) high byte. tkm016dl register bit 7 6 5 4 3 2 1 0 name d7 d6 d ? d4 d3 d ? d1 d0 r/w r r r r r r r r por 0 0 0 0 0 0 0 0 bit 7~0 d7~d0 : touch key module 16-bit counter (tmcnt) low byte. tkm010dl register bit 7 6 5 4 3 2 1 0 name d7 d6 d ? d4 d3 d ? d1 d0 r/w r r r r r r r r por 0 0 0 0 0 0 0 0 bit 7~0 d7~d0 : t ouch key module 1 0 -bit counter (tmcnt) bit 7~ bit 0. tkm0ro register bit 7 6 5 4 3 2 1 0 name d7 d6 d ? d4 d3 d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 1 bit 7~0 d7~d0 : integrated osc capacitor can select tkmorcc[7:0]50pf/256. it is not permitted to write a 00h value to this register.
rev. 1.40 ? 8 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?9 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale tkm0c0 register bit 7 6 5 4 3 2 1 0 name ? 0 ? xs1 ? 0 ? xs0 ? 0dfen ? 0filen ? 0sofc ? 0sof ? ? 0sof1 ? 0sof0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7~6 m0mxs1~m0mxs0 : multiplexer key select. 00: key 1 01: key 2 10: key 3 11: key 4 bit 5 m0dfen : double frequency function control 0: disable 1: enable bit 4 m0filen : flter function control 0: disable 1: enable bit 3 m0sofc : c to f osc frequency hopping function select 0: frequency hopping is controlled by software and c to f osc micro adjustment frequency is determined by the m0sof2~m0sof0 bits 1: frequency hopping controlled by hardware - m0sof2~m0sof0 bits have no effect. here the counters three msbs, selected by m0rovs2~m0rovs0, will automatically adjust the c to f osc micro adjustment frequency. bit 2~0 m0sof2~ m0sof0 : c to f osc frequency hopping frequency select 000: 400 khz 001: 425 khz 010: 450 khz 011: 475 khz 100: 500 khz 101: 525 khz 110: 550 khz 111: 575 khz
rev. 1.40 ?8 ?a??? 1?? ?01? rev. 1.40 ? 9 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale tkm0c1 register bit 7 6 5 4 3 2 1 0 name ? 0k4oen ? 0k3oen ? 0k ? oen ? 0k1oen ? 0k4io ? 0k3io ? 0k ? io ? 0k1io r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7 m0k4oen : key 4 sensor oscillat or control 0: disable 1: enable bit 6 m0k3oen : key 3 sensor oscillat or control 0: disable 1: enable bit 5 m0k2oen : key 2 sensor oscillat or control 0: disable 1: enable bit 4 m0k1oen: key 1 sensor oscillat or control 0: disable 1: enable bit 3 m0k4io : key 4 touch key input or i/o function 0: i/o 1: t ouch key inpu bit 2 m0k3io : key 3 touch key input or i/o function 0: i/o 1: t ouch key input bit 1 m0k2io : key 2 touch key input or i/o function 0: i/o 1: t ouch key input bit 0 m0k1io : key 1 touch key input or i/o function 0: i/o 1: t ouch key input
rev. 1.40 60 ? a ??? 1 ?? ? 01 ? rev. 1.40 61 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale tkm0c2 register bit 7 6 5 4 3 2 1 0 name ? 016cton ? 010cton ? 0st ? 0roen ? 0rcclr ? 016ctclr ? 010ctclr ? 0ros r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7 m016cton : 16-bit c/f counter control 0: disable 1: enable this bit is clear ed by hardware when the m0rcov bit is set to 1. bit 6 m010cton : 10-bit counter control 0: disable 1: enable this bit is clear ed by hardware when the m0rcov bit is set to 1 . bit 5 m0st : start f tmck and f vddck output clock 0: h ardware set enck to low , eference o scillator 13-stage counter stop 01: e nable the tmck and f vddck output clock - hardware set enck to high . h ardware s cl ears t he m0rcov fla g l ow and t he refe rence osci llator 13-sta ge counter start count . if the counter overfow , the m0rcov fag is set to 1, the hardware clears enck to low and the t ouch key interrupt request fag , tkf , will be set. a t ouch ke y int errupt wi ll be ge nerated i f t he t ouch ke y int errupt e nable bi t, tke , and the global interrupt bit, emi , are set to 1 . bit 4 m0roen : reference clock control 0: disable 1: enable bit 3 m0rcclr : c lear reference oscillator 13-stage counter 0: no change 1: clear counter the hardware circuit will clear this bit to zero after it is set to 1 by the user. bit 2 m016ctclr : 16-bit c/f c ounter clear control 0: no change 1: clear counter ha rdware will clear this bit to zero after it is set to 1 by user. bit 1 m010ctclr : 10 -bit counter clear control 0: no change 1: clear counter h ardware will clear this bit to zero after it is set to 1 by user. bit 0 m0ros : reference oscillator 13-stage counter clock source select 0: reference osc 1: key 4 sensor osc
rev. 1.40 60 ?a??? 1?? ?01? rev. 1.40 61 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale tkm0c3 register bit 7 6 5 4 3 2 1 0 name d9 d8 ? 0rcov ? 016ctov ? 010ctov ? 0rovs ? ? 0rovs1 ? 0rovs0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7~6 d9~ d8 : fvdd 10-bit c ounter it 9 and it 8 bit 5 m0rcov : 13-stage c ounter verfow lag 0: no overfow 1: overfow if the 13-stage counter overfow , the t ouch key interrupt request fag , tkf , will be set and the hardw are w ill clear en ck to low to disable the ftmck and fvd dck output. bit 4 m016ctov : 16-bit c/f c ounter verfow lag 0: no overfow 1: overfow this bit must be clear ed by software. bit 3 m010 ctov : 10 -bit c ounter verfow lag 0: no overfow 1: overfow this bit must be clear ed by software. bit 2~0 m0rovs2 ~ m0rovs 0 : reference oscillator 13-stage c ounter verfow t ime select witch 0 control bits: 000: 64 counts 001: 128 counts 010: 256 counts 011: 512 counts 100: 1024 counts 101: 2048 counts 110: 4096 counts 111: 8192 counts tkm0c4 register bit 7 6 5 4 3 2 1 0 name fvdd ? fvdd1 fvdd0 nor ? r/w r/w r/w r/w r/w por 0 0 0 0 bit 7 unimplemented, read as 0 bit 6~4 fvdd2~ fvdd0 : fvdd c lock ource elect 000: f /2 001: /4 010: /8 011: /16 100: /32 101: /64 110: /128 111: bit 3~1 unimplemented, read as 0 bit 0 norm : normal/ low power mode select 0: low power mode 1: n ormal mode
rev. 1.40 6 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 63 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale touch key operation when a fnger t ouches or i s i n proxi mity t o a t ouch pa d, t he c apacitance of t he pa d wi ll i ncrease. by using this capa citance variation to change slightly the frequency of the internal sense oscillator , touch actions can be sensed by mea suring these frequency changes. using an internal programmable divider the reference clock is used to generate a fixed time perio d . by counting a number of generated clock cycles from the sense oscillator during this fxed time period touch key actions can be determined. the device contai ns four touch key inputs which are shared with logical i/o pin s , with the desired function selected using register bits. the touch key module also has its own interrupt vector s and set of interrupts fags. during this reference clock fixed interval, the number of clock cycles generated by the s ense oscillator is measured, and it is this value that is used to determine if a touch action has been made or not. at the end of the fxed reference clock time interval, a t ouch key interrupt signal will be generated.                  
    
  
        
      
      ? 
 ?
         
        ? 
 ?
 touch switch module block diagram                    
                                 
                                  
                                  
               touch key or i/o function select
rev. 1.40 6? ?a??? 1?? ?01? rev. 1.40 63 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale touch key interrupt s the touch key module, which consists of four touch keys, has three independent interrupts, an overall touch key interrupt as well as one for the 16-bit c/f counter and one for the 10- bit counter. the 16-bit c/f counter and 10-bit counter interrupt s are contained within the multi-function interrupts and therefore do not have their own vector s . care must be taken during programming as the se counter interrupt fags contained within the multi-function interrupts will not be automatic ally reset upon entry into the interrupt service routine but rather m ust be reset m anually by t he appl ication progra m. more det ails rega rding t he touch key interrupts are located in the interrupt section of the datasheet. programming considerations after t he rel evant regi sters are se tup, t he t ouch key det ection process i s i nitiated t he cha nging t he m0st bit from low to high. this will enable and synchronise all relevant oscillators. charge pump and voltage regulator one char ge pump and one voltage regulator are implemented in this device as way of providing a stable voltage source for certain internal functions. an additional bandgap voltage source is also provided . operation the char ge pump can be enabled or disabled by the application program. the char ge pump uses vdd as its input, and has the function of doubling the vdd voltage. the output voltage of the charge pump will be vdd 2. the regulator can generate a stable voltage of 3.3v , which is used by the internal wdt and a/d converter and can also provide an exte rnal bridge sensor excitation voltage or supply a reference voltage for other applications. the user needs to guarantee that the charge pump output voltage is greater than 3.6v to ensure that the regulator generates the required 3.3v voltage output. the block diagram of this module is shown below. c?a?ge pump ( voltage double? ) vdd op adc vochp voreg chpc 1 chpc ? vdd vdd ? ? divide? fs chpckd regen chpen regulato? (3.3v) 3.3v charge pump and r egulator block diagram
rev. 1.40 64 ? a ??? 1 ?? ? 01 ? rev. 1.40 6? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale additionally, t he devic e a lso i ncludes a ba nd ga p vol tage ge nerator for t he 1.5v l ow t emperature sensitive re ference vol tage. t his refe rence vol tage i s use d a s t he z ero a djustment a nd for a si ngle end type reference voltage.             
     
   ?   ?? ? ? ? ??   ?     5),/  lv  derxw   .   dqg  wkh  uhfrpphqg  &),/  lv   f. note: the vobgp signal is only for internal used. it must not be connected to external components except for the recommend cfil capacitor. there is a single register associated with this module named chprc. the chprc is the char ge pump/regulator control register , which controls the char ge pump on/of f, regulator on/of f functions as well as a clock divider value to generate the char ge pump cloc k. the chpckd4~chpck d0 bits are use to set the clock divider to generate the desired clock frequency for proper char ge pump operation. the actual frequency is determined by the following formula. actual charge pump clock= (f sys /16) / (chpckd +1). chprc register bit 7 6 5 4 3 2 1 0 name chpckd4 chpckd3 chpckd ? chpckd1 chpckd0 bgpqst chpen regen r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7~3 : the charge pump clock divider these 5 bits select the c lock divide r ration of 1~32. charge pump clock = (f sys /16) / (chpckd+1) bit 2 : bandgap quick start-up function 0: r short, quickly start 1: r connected, normal rc flter mode every time when regen change s from 0 to 1 ( r egulator turn s on) , t his bit should be set to 0 and then set to 1 to make sure the bandgap stabilise s quickly ( t he minimum time is about 2ms now). bit 1 : charge pump on/off control 0: disable 1: enable note: this bit will be ignore d if the regen is disabled. bit 0 : regulator/charge-pump module on/off control 0: disable 1: enable
rev. 1.40 64 ?a??? 1?? ?01? rev. 1.40 6 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale regen chpen charge pump vochp pin regulator voreg pin opa, adc body fat circuit description 0 off vdd off hi- impedan ? e disable w ? ole module is disable d ? opa/ adc/body fat ? i ?? uit will lose powe ? 1 0 off vdd on 3.3v a ? tive use d w ? en v dd is g ? eate ? t ? an 3.6v (v dd > 3.6v) 1 1 on ? vdd on 3.3v a ? tive use w ? en v dd is less t ? an 3.6v (v dd = ? . ? v - 3.6v) the suggested char ge pump clock frequency is 20 k hz. the application needs to set the correct value to get the desired clock frequency . for a 4mhz application, the chpckd bits should be set to the value 11, and for a 2mhz application, the bits should be set to 5. the regen bit in the chprc register is the regulator/charge-pump module enable/disable control bit. if this bit is disabled, then the regulator will be disabled and the char ge pump will be also be disabled to save power . when regen= 0, the module will enter the p ower d own m ode ignoring the chpen setting. the a/d converter and opa will also be disabled to reduce power. if regen is set to 1, the regulato r will be enabled. if chpen is enabled, the char ge pump will be active and will use v dd as its input to generate the double voltage output. this double voltag e will be used as the input voltage for the regulator . if chpen is set to 0, the char ge pump is disabled and the charge pump output will be equal to the charge pump input v dd . it is nece ssary to take care of the v dd voltage. if the voltage is less than 3.6v , then chpen should be set to 1 to enable the char ge pump, otherwise chpen should be set to zero. if the char ge pump is disabled and v dd is less than 3.6v then the output voltage of the regulator will not be guaranteed. dual slope a/d converter a dua l sl ope a/d c onvert e r i s i mplemented i n the de vice . t he dual sl ope m odule i ncludes a n instrumentation am plifier, a pro grammable ga in am plifier, fo r t he a mplification o f d ifferential signals, an integrator and a comparator for the main dual slope ad convertor. there are two special function registers related to this function known as adcr and adcd. the adcr register is the a/d control register , which controls the adc block power on/of f, the chopper clock on/of f, the char ge/discharge control and is also used to read out the comparator output status. the adcd register is the a/d chopper clock divider register , which defnes the chopper clock to the adc module. the adpwren bit, defned in adcr register , is used to control the adc module on/of f function. the adccken bit, defined in the adcr register , is used to control the chopper clock on/of f function. when adccken is set to 1 it will enable the chopper clock, with the clock frequency defned by the adcd register . the adc module includes the opa, pga, integrator and comparator . however, the bandgap voltage generator is independent of this module. it will be automatically enabled when the regulator is enabled, and also be disabled when the regulator is disabled. the application progra m shoul d e nable t he re lated powe r t o pe rmit t hem t o func tion a nd di sable them when entering the power down mode to conserve power . the char ge/discharge control bits, addisch1 and addisch0, are used to control the dual slope circuit char ging and dischar ging behavior. the adcmpo bit is read only for the comparator output, while the adintm bits can set the adc mpo t rigger m ode f or i nterrupt g eneration. t he adc pga i nput si gnal c an c ome f rom the dchop or th/lb pin selected by the adis selection bit in adcd register . the pga gain can be either 2 or 4 determined by the pgag gain selection bit in the adcd register . the reference voltages of the adc integrator and comparator named vint and vcmp shown in the dual slope adc structure diagram can be selected by the adrr0 selection bit.
rev. 1.40 66 ? a ??? 1 ?? ? 01 ? rev. 1.40 67 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale                            
                    ?      ?    ? ? ?  ? ? ? ? ? ?         ? -? ?     ? -? ?     ? ????? ?   ?   
?
 
  -  ? ?
? ?

?     
 ? ?
? ? ? 
? ?  ? ??   ?   ?  ? 
  ?  

    ?? ?  ?  
?

?
? ? ? ?   ? 
 
?
? ?   ?  ? ?  dual slope adc structure an instrumentation amplifer is included to provide a high cmrr amplifying interface to differential signals fro m e xternal se nsors. w ith a st andard i nstrumentation a mplifer se tup of t hree ope rational amplifiers and a dac for of fset calibration, this structure provides a low noise sensor interface. two registers are used for overall control of the instrumentation ampl ifer and a single register for dac control. if these functions are not used they should be disabled using the register bits to reduce power consumption. op 3 + - op 4 - + 47 uf 16v 0.1uf 10? 10? 0. ?? uf op 5 - + dchop op 5p dopao op 5n dopap dopan 10? 8?k v out b?idge senso? gain = 1/2/4/8/ 16/ 32 gain = 4/5/6/7/8/9 ra _ string rb _ string 10k 10k 100pf 6 bits dac rsen rsen 100pf instrumentation amplifer
rev. 1.40 66 ?a??? 1?? ?01? rev. 1.40 67 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale                                dual slope a nolog digital convertor operation the following descriptions are based on the fact that the adrr0 bit is set to 0. the instrumentation a mplifier a nd pga c ombination, form a di fferential i nput pre -amplifier whic h amplifies the sensor input signal. the combination of the integrator , the comparator , the resistor r ds , between dsrr and dsrc and the capacitor c ds , between dsrc and dscc, form the main body of the dual slope adc. the integrator integrates the output voltage increase or decrease and is controlled by the switch circuit - refer to the block diagram. the integration and de-integration curves are illustrated by the following. the comparator will switch the state from high to low when v c , which is the dscc pin voltage, drops to less than 1/6 vdso. in gene ral a pplications, t he a pplication program wi ll swit ch t he adc t o t he cha rging m ode for a fxed time called t i , which is the integrating time. it will then switch to the dischar ging mode and wait for v c to drop to less than 1/6 vdso. at this point the comparator will change state and store the t ime ta ken, t c , whic h i s the de-integrat ing ti me. the fol lowing formul a 1 ca n t hen be used t o calculate the input voltage v a . formula 1: v a = (1/3) vdso (2 - t c /t i ). (based on adrr0=0) in use r a pplications, i t i s re quired t o c hoose t he c orrect va lue of r ds a nd c ds t o de termine t he t i value, to allow the v c value to operate between 5/6 vdso and 1/6 vdso. vful l cannot be greater than 5/6 vdso and v zero cannot be less than 1/6 vdso.                                 
             ?? 
rev. 1.40 68 ? a ??? 1 ?? ? 01 ? rev. 1.40 69 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale adcr register bit 7 6 5 4 3 2 1 0 name adccken adint ? 1 adint ? 0 adc ? po addisch1 addisch0 adpwren r/w r/w r/w r/w r r/w r/w r/w por 0 0 0 0 0 0 unknown bit 7 unimplemented, read as 0 bit 6 adccken : a/d convertor op chopper clock source on/off switching 0: disable 1: enable (clock value is defned by adcd register) bit 5~4 adintm1, adintm0 : adcmpo data interrupt trigger mode defnition 00: no interrupt 01: rising edge 10: falling edge 11: both edge bit 3 adcmpo: dual slope adc - last stage comparator output. read only bit, write data instructions will be ignored. during the discharging state, when the integrator output is less than the reference voltage,the adcmpo will change from high to low. bit 2~1 addisch1 ~ addisch0 : adc discharge/charge defnition 00: reserved 01: charging (integrator input connect to buffer output) 10: discharging (integrator input connect to vdso) 11: reserved bit 0 adpwren : dual slope block (including input op) power on/off switching 0: disable power 1: power source comes from the regulator adcd register bit 7 6 5 4 3 2 1 0 name pgag adis1 adis0 adrr0 adcd ? adcd1 adcd0 r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 1 1 1 bit 7 pgag : pga gain selection 0: gain = 2 1: gain = 4 bit 6~5 adis1 ~adis0 : a/d pga input selection 00: from rfc pin 01: from th/lb pin 10: from dchop pin 11: reserved bit 4 adrr0 : a/d integrator and comparator reference voltage selection 0: (vint, vcmp) = (4/6 vdso, 1/6 vdso) 1: (vint, vcmp) = (4.4/6 vdso, 1/6 vdso) bit 3 unimplemented, read as 0
rev. 1.40 68 ?a??? 1?? ?01? rev. 1.40 69 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale bit 2~0 adcd2 ~adcd 0 : c hopper clock defnition (adccken should be enable), the suggestion clock is around 10khz 000: (f sys /32)/1 001: (f sys /32)/2 010: (f sys /32)/4 011: (f sys /32)/8 100: (f sys /32)/16 101: (f sys /32)/32 110: (f sys /32)/64 111: (f sys /32)/128 name iaen g1 ? g11 g10 ia ? en g0 ? g01 g00 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7 iaen : op3, op4 on/off control 0: off 1: on bit 6 ~ 4 g12~g10 : instrumentation amplifer 2nd stage gain 000: 4 001: 5 010: 6 011: 7 100: 8 101: 9 110: undefned 111: undefned bit 3 ia2en : op5 on/off control. 0: off 1: on bit 2 ~ 0 g02~g00 : instrumentation amplifer 1st stage gain 000: 1 001: 2 010: 4 011: 8 100: 16 1xx: 32 name chopen bi_pga1 bi_pga0 iad ? iad1 iad0 rsen r/w r/w r/w r/w r/w r/w r/w r/w por 1 1 1 1 0 0 0 1 'x' unkno wn bit 7 chopen : op3, op4 chopper enable 0: d isable 1: ena ble bit 6 ~ 5 bi_pga1~bi_pga0 : op3 and op4 operating current selection 00: undefned 01: undefned 10: undefned 11: 7i (op3 and op4 current=400a, ia (op3, op4, op5) current=1.2ma)
rev. 1.40 70 ? a ??? 1 ?? ? 01 ? rev. 1.40 71 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale bit 4 ~ 2 iad2~iad1 : chopper clock select ia chopper clock defned as: 000: clock= (f sys /32)/1 001: clock= (f sys /32)/2 010: clock= (f sys /32)/4 011: clock= (f sys /32)/8 100: clock= (f sys /32)/16 101: clock= (f sys /32)/32 110: clock= (f sys /32)/64 111: clock= (f sys /32)/128 a suggested clock speed has a range of around 8-10khz. note that chopen must be enabled C here the ia chopper clock is approximate 8k ~10k.(7.8125k ~ 1 1.71875k) and the adc chopper clock must be < 8k. bit 1 unimplemented, read as "0" bit 0 rsen : op5 external/internal gain setup control bit 0: open loop setup C gain defned by external reisistors. 1: closed loop setup C gain defned by g10, g11 and g12 bits in the iac0 register. name iadaen d ? d4 d3 d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7 iadaen : ia dac enable/disable 0: disable 1: enable bit 6 unimplemented, read as "0" bit 5 ~ 0 d5~d0 : dac output v oltage setup bits note: the dac output range is 0v ~ {v oreg -(v oreg /64)} 1 lsb = 1 digital code = v oreg /64 output v oltage= v oreg /64*(d[5:0]) interrupts are an important part of any microcontroller system. when an external event or an internal function such as a t imer/event counter or an a/d converter requires microcontroller attention, their corresponding interrupt will enforce a temporary suspension of the main program allowing the microcontroller to direct attention to their respective needs. the device provides an external interrupt and multiple internal interrupts . the external interrupt is controlled by the action of the external interrupt pin, while the interna l interrupts are controlled by the timer/event counters , t ouch key and a/d converter. overall interrupt control, which means interrupt enabling and request fag setting, is controlled by using t hree registers, intc0, intc1 and mfic. by cont rolling t he appropri ate ena ble bit s i n t his registers each individual interrupt can be enabled or disabled. also when an interrupt occurs, the corresponding reques t f ag w ill be s et by the microcontroller . the global enable f ag if cleared to zero will disable all interrupts.
rev. 1.40 70 ?a??? 1?? ?01? rev. 1.40 71 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale intc0 register bit 7 6 5 4 3 2 1 0 name t1f t0f eif et1i et0i eei e ? i r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 bit 7 unimplemented, read as 0 bit 6 t1f : t imer/event counter 1 interrupt request fag 0: inactive 1: active bit 5 t0f : t imer/event counter 0 interrupt request fag 0: inactive 1: active bit 4 eif : external interrupt request fag 0: inactive 1: active bit 3 et1i : t imer/event counter 1 interrupt enable 0: disable 1: enable bit 2 et0i : t imer/event counter 0 interrupt enable 0: disable 1: enable bit 1 eei : external interrupt enable 0: disable 1: enable bit 0 emi : master interrupt global enable 0: disable 1: enable intc1 register bit 7 6 5 4 3 2 1 0 name tkf adf ? ff tke eadi e ? fi r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 bit 7 unimplemented, read as 0 bit 6 tkf : t ouch key interrupt request fag 0: inactive 1: active bit 5 adf : a /d convertor request fag 0: inactive 1: active bit 4 mff : multi - function interrupt request fag 0: inactive 1: active bit 3 unimplemented, read as 0 bit 2 tke : t ouch key interrupt enable 0: disable 1: enable
rev. 1.40 7 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 73 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale bit 1 eadi : a /d convertor interrupt enable 0: disable 1: enable bit 0 emfi : multi - function interrupt enable 0: disable 1: enable mfic register bit 7 6 5 4 3 2 1 0 name ? 16ctf ? 10ctf t ? f ? 16cte ? 10cte et ? i r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 bit 7 unimplemented, read as 0 bit 6 m16ctf : t ouch key module 16-bit counter interrupt request fag 0: inactive 1: active bit 5 m10ctf : t ouch key module 1 0 -bit counter interrupt request fag 0: inactive 1: active bit 4 t2f : timer/event counter 2 interrupt request fag 0: inactive 1: active bit 3 unimplemented, read as 0 bit 2 m16cte : t ouch key module 16-bit counter interrupt enable 0: disable 1: enable bit 1 m10cte : t ouch key module 1 0 -bit counter interrupt enable 0: disable 1: enable bit 0 et2i: t imer/event counter 2 interrupt enable 0: disable 1: enable interrupt operation a t imer/event or t ouch key counter overf ow, an active edge on the external interrupt pin, a/d conversion completion , or a signal completion of the t ouch key sensor will all generate an interrupt request b y se tting t heir c orresponding r equest fa g, i f t heir a ppropriate i nterrupt e nable b it i s se t. when t his h appens, t he pr ogram c ounter, wh ich st ores t he a ddress o f t he n ext i nstruction t o b e executed, wi ll b e t ransferred o nto t he st ack. t he pr ogram c ounter wi ll t hen b e l oaded wi th a n ew address which will be the value of the corresponding interrupt vector . the microcontroller will then fetch its next instruction from this interrupt vector . the instruction at this vector will usually be a jmp statement which will jump to another section of program which is known as the interrupt service routine. here is located the code to control the appropriate interrupt. the interrupt service routine must be terminated with a reti instruction, which retrieves the original program counter address from the stack and allows the microcontroller to continue with normal execution at the point where the interrupt occurred.
rev. 1.40 7? ?a??? 1?? ?01? rev. 1.40 73 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale the various interrupt enable bits, together with their associated request flags, are shown in the following diagram with their order of priority. 04 h 08 h 0ch 10 h 14 h 18 h low priority high reques t flag s enable bits master enable reques t flag s enable bits emi auto disabled in is r interrup t name interrup t name em i em i em i em i em i em i m16ctf tk 16-bit m16cte ei f int pin ee i t0 f timer0 et0i t1 f timer1 et1i mf f multi-function emfi ad f a/ d ead i tk f touc h ke y tk e xx f request flag ? no auto reset in is r xx f request flag ? auto reset in is r xx e enable bi t m10ctf tk 10-bit m10cte t2 f timer2 et21 interrup t vector interrupts contained wi thin mult i- functi on interrupt 04 h 08 h 0ch 10 h 14 h 18 h low priority high reques t flag s enable bits master enable reques t flag s enable bits emi auto disabled in is r interrup t name interrup t name em i em i em i em i em i em i m16ctf tk 16-bit m16cte ei f int pin ee i t0 f timer0 et0i t1 f timer1 et1i mf f multi-function emfi ad f a/ d ead i tk f touc h ke y tk e xx f request flag ? no auto reset in is r xx f request flag ? auto reset in is r xx e enable bi t m10ctf tk 10-bit m10cte t2 f timer2 et21 interrup t vector interrupts contained wi thin mult i- functi on interrupt interrupt structure once an interrupt subroutine is serviced, all the other interrupts will be blocked, as the emi bit will be cleared automatically . this will prevent any further interrupt nesting from occurring. however , if other interrupt requests occur during this interval, although the inter rupt will not be immediately serviced, the request fag will still be recorded. if an interrupt requires immediate servicing while the program is alread y in another interrupt service routine, the emi bit should be set after entering the routine, to allow interrupt nesting. if the stack is full, the interrupt request will not be acknowledged, even if the related interrupt is enabled, until the stack pointer is decremented. if immediate service is desired, the stack must be prevented from becoming full. when an interrupt request is generated it takes 2 or 3 instruction cycle before the program jumps to the interrupt vector . if the device is in the sleep or idle mode and is woken up by an interrupt request then it will take 3 cycles before the program jumps to the interrupt vector.
rev. 1.40 74 ? a ??? 1 ?? ? 01 ? rev. 1.40 7? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ?ain p?og?am enable bit set ? ?ain p?og?am automati?ally disable inte??upt clea? e?i & request flag wait fo? ?~ 3 inst?u?tion cy?les isr ent?y ... ... reti ( it will set e?i automati?ally ) inte??upt request o? inte??upt flag set by inst?u?tion n y interrupt flow interrupt priority interrupts, occurri ng in the interval between the rising edges of two consecutive t2 pulses, will be serviced on the latter of the two t2 pulses, if the corresponding interrupts are enabled. in case of simultaneous requests, the following table shows the priority that is applied. these can be masked by resetting the emi bit. interrupt source priority vector exte ? nal inte ?? upt 0 1 04h timer/event counter 0 overfow ? 08h timer/event counter 1 overfow 3 0ch ? ulti fun ? tion inte ?? upt (timer/event counter overfow 2 and touch key module 10-bit/16-bit counter overfow) 4 10h a/d c onve ? to ? inte ?? upt ? 14h tou ?? key inte ?? upt 6 18h interrupt subroutine vector in cases where both external and internal interrupts are enabled and where an external and internal interrupt occurs simultaneously , the external interrupt will always have priority and will therefore be serviced frst. suitable masking of the individual interrupts using the interrupt registers can prevent simultaneous occurrences. external interrupt for an external interrupt to occur , the global interrupt enable bit, emi, and external interrupt enable bit, e ei, m ust fr st b e se t. an a ctual e xternal i nterrupt wi ll t ake p lace wh en t he e xternal i nterrupt request fag, eif , is set, a situation that will occur when an edge transition appears on the external int l ine. t he t ype o f t ransition t hat wi ll t rigger a n e xternal i nterrupt, wh ether h igh t o l ow, l ow t o high or both is determined by the eintc0 and eintc1 bits, which are bits 6 and 7 respectively , in the ctrl1 control register. these two bits can also disable the external interrupt function.
rev. 1.40 74 ?a??? 1?? ?01? rev. 1.40 7 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale eintc1 eintc0 edge trigger type 0 0 disable 0 1 falling edge t ? igge ? 1 0 rising edge t ? igge ? 1 1 dual edge t ? igge ? the e xternal i nterrupt p in i s p in-shared wi th t he i /o p in pb 4 a nd c an o nly b e c onfigured a s a n external i nterrupt p in i f t he c orresponding e xternal i nterrupt e nable b it i n t he i ntc0 r egister h as been se t a nd t he e dge t rigger t ype ha s be en se lected usi ng t he c trl1 re gister. t he pi n m ust a lso be setup as an input by setting the corresponding pbc.4 bit in the port control register . when the interrupt is enabled, the stack is not full and an active transition appears on the external interrupt pin, a subroutine call to the external interrupt vector at location 04h, will take place. when the interrupt is service d, the external interrupt request fag, eif , will be automatically reset and the emi bit will be automatically cleared to disable other interrupts. note that any pull-high resistor connections on this pin will remain valid even if the pin is used as an external interrupt input. timer/event counter interrupt for a t imer/event counter interrupt to occur , the global interrupt enable bit, em i, and the corresponding ti mer interrupt enable bit, et ni, must first be set . an act ual t imer/event counter interrupt will take place when the t imer/event counter request fag, tnf , is set, a situation that will occur when the relevant t imer/event counter overfows. when the interrupt is enabled, the stack is not ful l and a t imer/event counte r n overfl ow occ urs, a subrout ine ca ll t o t he rel evant t imer interrupt vector , will take place. when the interrupt is serviced, the tim er interrupt request fag, tnf , will be automatically reset and the emi bit will be automatically cleared to disable other interrupts. multi-function interrupt the device has one multi-function interrupt. unlike the other independent interrupts, thi s interrupt have no i ndependent sourc e, but ra ther are form ed from ot her e xisting i nterrupt sourc es, na mely touch key 16-bit counter interrupt , touch key 10-bit counter interrupt and timer/event counter 2 interrupt. a multi-function interrupt request will take place when any of the multi-function interrupt request flag mff is set. the multi-function interrupt flag will be set when any of its included functions generate an interr upt request fag. t o allow the program to branch to its respective interrupt vector address, when the multi-function interrupt is enabled and the stack is not full, and either one of the interrupts contained within multi-function interrupt will occur, a subroutine call to one of the multi- function interrupt vectors will take place. when the interrupt is service d, the related multi-function request fag will be automatically reset and the emi bit will be automatically cleared to disable other interrupts. however, it must be noted that, although the multi-function interrupt flag will be automatically reset when the interrupt is serviced , the request fag from the original source of the multi-function interrupt, namely t ouch key 16-bit counter interrupt , touch key 10-bit counter interrupt and timer/event counter 2 interrupt will not be automatically reset and must be manually reset by the application program.
rev. 1.40 76 ? a ??? 1 ?? ? 01 ? rev. 1.40 77 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale a/d converter interrupt the a/ d c onverter i nterrupt i s i nitialized b y se tting t he a/ d c onverter r equest fa g, c aused b y a n end of a/d conversion. when the interrupt is enabled, the stack is not full and the adf is set, a sub- routine call will occur . the related interrupt request fag adf will be reset and the emi bit cleared to disable further interrupts. touch key interrupt the t ouch key interrupt is initiali z ed by setting the t ouch key interrupt request fag, tkf , bit 6 of int c1. t his i s ca used by a si gnal c ompletion of t he t ouch ke y se nsor. aft er t he i nterrupt i s enabled, and the stack is not full, and the tkf bit is set, a sub - routine call will occur . the related interrupt request fag tkf , will be reset and the emi bit is cleared to disable further interrupts. programming considerations by di sabling t he re levant i nterrupt e nable bi ts, a re quested i nterrupt c an be pre vented from be ing serviced, however , once an interrupt request flag is set, it will remain in this condition in the interrupt register until the corresponding interrupt is serviced or until the request fag is cleared by the application program. it is recom mended that programs do not use the call instruction within the interrupt service subroutine. interrupts often occur in an unpredictable manner or need to be serviced immediately . if only one stack is left and the interrupt is not well controlled, the original control sequence will be damaged once a call subroutine is executed in the interrupt subroutine. every interrupt has the capability of waking up the microcontroller when it is power down mode, the wake up being generated when the interrupt request flag changes from low to high. if it is required to prevent a certain interru pt from waking up the microcontrol ler then its respective request fag should be frst set high before entering the power down mode. as only the program counter is pushed onto the stack, then when the interrupt is serviced, if the contents of the accumulator , status register or other registers are altered by the interrupt service program, t heir c ontents shoul d be sa ved t o t he m emory a t t he be ginning of t he i nterrupt se rvice routine. to return from an interrupt subroutine, either a ret or reti instruction may be executed. the reti instruction in addition to executing a return to the main program also automatically sets the emi bit high to allow further interrupts. the ret instruction however only executes a return to the main program leaving the emi bit in its present zero state and therefore disabling the execution of further interrupts.
rev. 1.40 76 ?a??? 1?? ?01? rev. 1.40 77 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale lcd driver for lar ge volume applications, which incorporate an lcd in their design, the use of a custom display rather than a more expensive character based display reduces costs signifcantly . however , the corresponding signals required, which vary in both amplitude and time, to drive such a custom display require many special consi derations for proper lcd operation to occur . the holtek lcd driver function, with its internal lcd signal generating circuitry and various options, will automatically generate these time and amplitude varying signals to provide a means of direct driving and easy interfacing to a range of custom lcds. lcd memory an area of data memory is especially reserved for use by the lcd data. this data area is known as the lcd memory . any data written here will be automatically read by the internal lcd driver circuits, which will in turn automatically generate the necessary lcd driving signals. therefore any data written into the lcd memory will be immediately refected i nto t he a ctual l cd d isplay c onnected t o t he m icrocontroller. t he st art a ddress o f the lcd memory is 40h; the end address of the lcd memory is 5bh. as the lcd data memory addresses overlap those of the general purpose data memory , the lcd data memory is stored in its own memory data bank, which is dif ferent from that of t he ge neral purpose da ta me mory. the l cd da ta me mory i s st ored i n ba nk 1. the data memory bank is chosen by using the bank pointer , which is a special function register in the data memory , with the name, bp . when the lowest bit of the bank pointer has the binary value 0, only the general purpose data memory will be accessed, no read or write actions to the lcd memory will take place. t o access the lcd memory therefore requires frst that bank 1 is selected by setting the lowest bit of the bank pointer to the binary value 1. after this, the lcd memory can then be accessed by using indirect addressing through the use of memory pointer mp1. w ith bank 1 selected, then using mp1 to read or write to the memory area 40h~ 5b h, will result in operations to the lcd memory . directly addressing the lcd memory is not applicable and will result in a data access to the bank 0 general purpose data memory.                                 lcd memory map
rev. 1.40 78 ? a ??? 1 ?? ? 01 ? rev. 1.40 79 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale lcd registers a single lcd control register s in the data memory, known as lcdc, is used to control the various setup features of the lcd driver . v arious bits in this register control functions such as va voltage, bias type, duty type as well as lcd com/seg selection . lcdc register bit 7 6 5 4 3 2 1 0 name lcdpd vas rcs css ? css1 css0 r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 bit 7 : lcd on/off control 0: lcd enable 1: lcd disable bit 6 : va voltage selection for c type lcd 0: voreg 1: 1.5voreg bit 5 unimplemented, read as 0 bit 4 : lcd type r or c 0: r type 1: c type bit 3 unimplemented, read as 0 bit 2~0 : lcd com[7:4]/seg[27:24] selection, refer to the following table for details note: when the charge pum p out put vol tage i s equal t o vdd , the c-t ype l cd bi as can only be select ed as v a=voreg . when the charge pump output volta ge is equal to 2vdd , the c-type lcd bias can be select ed as va=voreg or v a=voreg1.5 . when the c-type lcd voltage is selected to be pumped to voregx1.5 , the power supply to vdd should be limited to 2.6v~5.5v . ccs[2:0] duty com4/seg27 com5/seg26 com6/seg25 com7/seg24 segcom (maximum) 000 1/4 seg ? 7 seg ? 6 seg ?? seg ? 4 ? 84 001 1/ ? co ? 4 seg ? 6 seg ?? seg ? 4 ? 7 ? 010 1/6 co ? 4 co ?? seg ?? seg ? 4 ? 66 011 1/7 co ? 4 co ?? co ? 6 seg ? 4 ?? 7 1 1/8 co ? 4 co ?? co ? 6 co ? 7 ? 48 the l cdout re gister is use d t o determine i f t he out put func tion of l cd pi ns se g0~seg 7 a re used a lcd segment drivers or normal i/o operation .
rev. 1.40 78 ?a??? 1?? ?01? rev. 1.40 79 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale lcdout register bit 7 6 5 4 3 2 1 0 name lcds7 lcds6 lcds ? lcds4 lcds3 lcds ? lcds1 lcds0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7 lcds7 : select seg7 or i/o 0: i/o 1: seg7 bit 6 lcds6 : select seg 6 or i/o 0: i/o 1: seg 6 bit 5 lcds5 : select seg 5 or i/o 0: i/o 1: seg 5 bit 4 lcds4 : select seg 4 or i/o 0: i/o 1: seg 4 bit 3 lcds3 : select seg 3 or i/o 0: i/o 1: seg 3 bit 2 lcds2 : select seg 2 or i/o 0: i/o 1: seg 2 bit 1 lcds1 : select seg 1 or i/o 0: i/o 1: seg 1 bit 0 lcds0 : select seg 0 or i/o 0: i/o 1: seg 0 lcd clock the lcd clock is driven by the f clock, which then passes through a divider , the division ratio of which is selected by the lcd clock selection bits, lcdck1 and lcdck0, in the ctrl0 register to provide a lcd cl ock fre quency of f /3, f /4 or f /8. the lcd cl ock sourc e f can be derived from the lirc or lxt oscillator selected by the selection bit, named fsubs. note that the clock can be enabled or disabled in the power down mode by the f clock control bit fsubc in the ctrl0 register. lcd driver output the output structure of the device lcd driver can be 248 to 284. the lcd driver bias type has r and c type. the c/r type and number of com and seg is selected by software option. the lcd driver has a fxed 1/3 bias. the nature of liquid crystal displays require that only ac voltages can be applied to their pixels as the application of dc voltages to lcd pixels may cause permanent damage. for this reason the relative contras t of an lcd display is controlled by the actual rms voltage applied to each pixel, which is equal to the rms value of the voltage on the com pin minus the voltage applied to t he seg p in. t his d ifferential r ms v oltage m ust b e g reater than t he l cd sa turation v oltage
rev. 1.40 80 ? a ??? 1 ?? ? 01 ? rev. 1.40 81 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale for the pixel to be on and less than the threshold voltage for the pixel to be of f. the requirement to lim it the dc voltage to zero and to control as many pixels as possible with a minimum number of connections, requires that both a time and amplitude signal is generated and applied to the application lcd. these time and amplitude varying signals are automatically generated by the lcd driver circuits in the microcontroller . what is known as the duty determines the number of common lines used, which are also known as backplanes or coms. the duty , which is chosen by control bit s to have a value of 1/4 , 1/5, 1/6 or 1/7, 1/8 and which equates to a com number of 3 , 4, 5, 6 and 7 respectively , therefore defnes the number of time divisions within each lcd signal frame. the accompanying timing diagrams depict the lcd signals generated by the microcontroller for various values of duty and bias. lcd voltage source and biasing the t ime a nd a mplitude v arying si gnals g enerated b y the l cd dr iver f unction r equire t he g eneration of several voltage levels for their operation. the number of voltage levels used by the signal depends upon the value of the cssn bit s in the lcdc register . the device can have either r type or c type biasing selected via the rcs bit in the lcdc register. selecting the c type biasing will enable an internal char ge pump whose multiplying ration can be selected using an additional confguration option. for r type biasing an external lcd voltage source is supplied by the internal vlcd biasing voltage. this could be the microcontroller power supply or some other voltage source. for the r t ype 1/ 3 bias se lection, t hree vol tage l evels vss, v a , vb a nd vc a re utilised. t he vol tage v a is equal to vlcd. vb is equal to 2 / 3 vlcd. v c is equal to 1 / 3 vlcd . note that no external capacitors or resistors are required to be connected if r type biasing is used. for c t ype b iasing a n e xternal l cd v oltage so urce a lso is su pplied b y the i nternal vl cd b iasing voltage or vmax . the c type biasing scheme uses an internal char ge pump circuit, which in the case o f t he 1 /3 bias c an g enerate v oltages h igher t han wh at i s supplied by vl cd. t his f eature is useful in applications where the microcontroller supply voltage is less than the supply voltage required by the lcd. the bit v as is selected for v a voltage in c type lcd . the relation of lcd voltage is as following fgure.                                    
         ? ? ? ? ? ? ?                    ? ? ?               
         ? ? ? ? ? ? -?                 -?   ? -?   ? -?   ? -?   ? -?   ? -?   ? 1rwh    eldv  9 $6    :  9 $%  lv  9 $   eldv  9 $6    :  9 $%  lv  9%
rev. 1.40 80 ?a??? 1?? ?01? rev. 1.40 81 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale                            



 
 
 
 
 











         ? ?  ?  ? ?
?
  ?
 ? 
  ?
 ? 
              programming considerations certain precautions must be taken when programming the lcd. one of these is to ensure that the lcd memory is properly initialis ed after the microcontroller is pow ered on. like the general purpose data memory , the contents of the lcd memory are in an unknown condition after power - on. as the contents of the lcd memory will be mapped into the actual lcd, it is important to initialise this memory area into a known condition soon after applying power to obtain a proper display pattern. consideration must also be given to the capacitive load of the actual lcd used in the application. as t he l oad pre sented t o t he m icrocontroller by l cd pi xels c an be ge nerally m odeled a s m ainly capacitive in nature, it is important that this is not excessive, a point that is particularly true in the case of the com lines which may be connected to many lcd pixels. the accompanying diagram depicts the equivalent circuit of the lcd. with such a frequency chosen, the microcontroller internal lcd driver circuits will ensure that the appropriate lcd driving signals are generated to obtain a suitable lcd frame frequency.
rev. 1.40 8 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 83 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale confguration options confguration options refer to certain options within the mcu that are programmed into the otp program memory device during the programming process. during the development process, these options are selected using the ht -ide software development tools. as these options are programmed into the device us ing the hardw are programming tools , once they are s elected they cannot be changed later by the application software. all options must be defned for proper system function, the details of which are shown in the table. no. options oscillator options 1 system os ? illato ? sele ? tion - f sys : 1. hxt ? . erc 3. hirc ? hirc f ? equen ? y sele ? tion: 1. 4 ? hz ? . 8 ? hz 3. 1 ?? hz 3 exte ? nal 3 ? khz os ? illato ? sele ? tion: 1. i/o ? . 3 ? .768khz exte ? nal ?? ystal 4 system os ? illato ? sst pe ? iod sele ? tion: 1.10 ? 4 ? lo ? ks ? . ? ? lo ? ks reset pin options ? p a7/res pin options: 1. res pin ? . i/o pin lcd options 6 lcd fun ? tion in powe ? down mode: 1. enable ? . disable 7 r type d ? ive ? u ?? ent sele ? tion: 1. ? 0 a ? . 100a watchdog options 8 wdt fun ? tion 1. always enable ? . wdt enable/disable by s/w 9 wdt ? lo ? k sele ? tion - f s : 1. inte ? nal 1 ? khz rc os ? illato ? - lirc ? . f sys /4 3. 3 ? .768khz os ? illato ? 10 clrwdt inst ? u ? tion sele ? tion: 1. inst ? u ? tion ? . inst ? u ? tion
rev. 1.40 8? ?a??? 1?? ?01? rev. 1.40 83 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale body fat measurement function the body fat circu it consists of a sine wave generator, an amplifer and a flter. the circuit has been designed for maximum fexibility and has a high degree of functional integration to implement a body fat measurement function . sine wave generator the si ne wave generator c onsists of a frequency d ivider, c ounter, r am, 10-bit dac a nd op0. the circuit can generate a s ine w ave output w ith a frequency range of 5khz~50khz using a 329 bit ram for the sine wave pattern simulation. the frequency divider will multiply by dn/m to generate a clock for the counter . the following points must be noted to understand how the sine wave is generated: ? system clock/m = sine wave frequency ? system clock (dn/m) = the count rate of the counter ? m must be a multiple of n and 8. ? m = n dn ? dnr = dn/2 ? dn: sine wave cycle data numerical value (dn <= 64) ? dnr: the data numerical value of the 1/2 sine wave cycle stored in ram (dnr <= 32) refer to the following table and fgure for more details. system frequency 4 ? hz 8 ? hz 1 ?? hz sine w ave frequency (khz) ? 0 ? ? 0 ? ? 0 ? m 80 800 160 1600 ? 40 ? 400 n ? 16 4 ?? 4 40 dn 40 ? 0 40 64 60 60 dnr ? 0 ?? ? 0 3 ? 30 30 p0 p1 p2 -512 511 0 p dnr- 1 p dnr -2 . . . p dnr -3
rev. 1.40 84 ? a ??? 1 ?? ? 01 ? rev. 1.40 8? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale only a half sine wave pattern p0~p dnr-1 is generated which is stored in ram bank 2 with an address range of 40h~7fh. t he sine wave pattern data bits [7:0] are stored with even address es while the sine wave pattern data bit [8] is stored with an odd address. once the sine wave generator is enabled, the cpu will not be able to write or read data to/from this ram area. the sine generator will read the ram data and transmit it to the 10-bit dac. the device will read the half sine wave pattern from the ram and generate the actual sine waveform on the sin pin. r efer to the following diagram: 2's complement d[9:0] d[9] dn_cnt/2 >= dnr 0 1 0 1 + sine[8:0] dac 0 1 d[8:0] + + + + 7dh 7ch 7bh 7eh 7fh . . . ram(bank 2) sine0[8:0] sine1[8:0] sine2[8:0] sine3[8:0] . . . . . sine30[8:0] sine31[8:0] sine32[8:0] sine33[8:0] sine wave pattern sine0[7:0] sine0[8] sine1[7:0] sine1[8] sine30[7:0] sine30[ 8] sine31[7:0] sine31[ 8]
rev. 1.40 84 ?a??? 1?? ?01? rev. 1.40 8 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale sgc register bit 7 6 5 4 3 2 1 0 name sgen bren r/w r/w r/w por 0 0 0 0 0 0 bit 7 sgen: sine generator enable bit 0: disable 1: enable hen this bit is equal to 0, the op0 and 10-bit dac will be in a power down mode . bit 6~5 unimplemented, read as 0 bit 4 bren : bias resistor enable 0: disable - power down mode 1: enable - normal mode when this bit is enabled, it will generate a 0.5voreg voltage for the non-inverting input of opa1 and opa2. bit 3~0 unimplemented, read as 0 sgn register bit 7 6 5 4 3 2 1 0 name d ? d4 d3 d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 bit 7~6 unimplemented, read as 0 bit 5~0 d5~d0: system frequency multiplicator - multiplicator (n) equal to d [5:0] + 1 sgdnr register bit 7 6 5 4 3 2 1 0 name d4 d3 d ? d1 d0 r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 bit 7~5 unimplemented, read as 0 bit 4~0 d4~d0: 1/2 sine wave cycle numerical value stored in ram bank 2 dnr is equal to d [4:0] + 1 amplifer the amplifer consists of op1, op2, a 6-bit dac and analog switches. op2 is a differential amplifer with 1~5 multiple gain. the 6-bit dac of fers a reference voltage to the non-inverting input of op2. the user can turn on and of f switch 0 to 7 to obtain a reference resistor voltage and a body resistor voltage. the body and reference impedance can be obtained by using the sw0 ~ sw7 switches. refer to following table for this impedance switching. switch sw0 sw1 sw2 sw3 sw4 sw5 sw6 sw7 foot impedan ? e o o o reference 1k o o o reference 200 o o o o: s wit ?? ? losed.
rev. 1.40 86 ? a ??? 1 ?? ? 01 ? rev. 1.40 87 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale opac register bit 7 6 5 4 3 2 1 0 name opa en op ? g3 op ? g ? op ? g1 op ? g0 r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 bit 7 opa en: amplifer enable control 0: enable 1: disable when this bit is equal to 1, op1, op2 and the 6-bit dac will be in a power down mode. bit 6~4 unimplemented, read as 0 bit 3~0 op2g3 ~op2g 0 : op2 gain control 0001: 1.14 0010: 1.31 0011: 1.5 0100: 1.73 0101: 2 0110: 2.33 0111: 2.75 1000: 3.285 1001: 4 1010: 5 others : 1 swc register bit 7 6 5 4 3 2 1 0 name sw7 sw6 sw ? sw4 sw3 sw ? sw1 sw0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 0 bit 7 sw7: witch 7 control bit 0: open 1: short bit 6 sw6: witch 6 control bit 0: open 1: short bit 5 sw5: witch 5 control bit 0: open 1: short bit 4 sw4: witch 4 control bit 0: open 1: short bit 3 sw3: witch 3 control bit 0: open 1: short bit 2 sw2: witch 2 control bit 0: open 1: short bit 1 sw1: witch 1 control bit 0: open 1: short bit 0 sw0: witch 0 control bit 0: open 1: short
rev. 1.40 86 ?a??? 1?? ?01? rev. 1.40 87 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale daco register bit 7 6 5 4 3 2 1 0 name d ? d4 d3 d ? d1 d0 r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 bit 7~6 unimplemented, read as 0 bit 5~0 d5~d0: 6-bit dac output voltage output voltage = 0.5v oreg * ((d[5:0] + 1)/64) filter the flter consists of cp0, a pmos transistor and some analog switch s. the flter contains a peak detection function for which an external capacit or will store the peak value for transmission to the adc. switches sw8 and sw9 are for capacit or discharge purposes. ftrc register bit 7 6 5 4 3 2 1 0 name ftren sw9 sw8 r/w r/w r/w r/w por 0 0 0 bit 7 ftren: flter enable 0: disable 1: enable when this bit is equal to 0, cp0 and the pmos transistor will be in a power down mode. bit 6~5 unimplemented, read as 0 bit 4 reserved C must be cleared to 0 bit 3~2 unimplemented, read as 0 bit 1 sw9: witch control bit 0: open 1: short bit 0 sw8: witch 8 control bit 0: open 1: short
rev. 1.40 88 ? a ??? 1 ?? ? 01 ? rev. 1.40 89 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale application circuits ????????? ????????? ????? ????? ????? ????? ???? ???? ???? ????? ??????? ??????? ??????? ??????? ??????? ?????? ??????? ???????? ???????? ???????? ???????? ???????? ??? ??? ???? ???? ??? ? ??? ??? ?????????? ?? ????? ????? ????? ????? ????? ?? ?? ?? ???? ??? ??? ???? ? ??? ???????? ?? ?? ? ?? ?? ???????? ??????????????????? ????????????????????????? ???????????????? ????????? ???? ?? ????? ??????? ???????? ?? ???? ???? ???? ???? ???? ?? ? ????? ????? ????? ????? ??? ??? ??? ??? ??? ??? ??? ??? ?? ?? ??? ?? ??? ??? ?????
rev. 1.40 88 ?a??? 1?? ?01? rev. 1.40 89 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale instruction set introduction central to the successful operation of any microcontroller is its instruction set, which is a set of program instruction codes that direc ts the microcontroller to perform certain operations. in the case of holtek microcontrollers, a comprehensive and fexible set of over 60 instructions is provided to enable programmers to implement their application with the minimum of programming overheads. for easier understanding of the various instruction codes, they have been subdivided into several functional groupings. instruction timing most instructions are implemented within one instruction cycle. the exceptions to this are branch, call, or table read instructions where two ins truction cycles are required. one instruction cycle is equal to 4 system clock cycles, therefore in the case of an 8mhz system oscillator , most instructions would be i mplemented wi thin 0.5 s a nd bra nch or c all i nstructions woul d be i mplemented wi thin 1s. although instructions which require one more cycle to implement are generally limited to the jmp , call, ret , reti and table read instructions, it is important to realize that any other instructions which involve manipulation of the program counter low register or pcl will also take one more cycle to implement. as instructions which change the contents of the pcl will imply a direct j ump t o t hat ne w a ddress, one m ore c ycle wi ll be re quired. e xamples of suc h i nstructions would be "clr pcl" or "mov pcl, a". for the case of skip instructions, it must be noted that if the result of the comparison involves a skip operation then this will also take one more cycle, if no skip is involved then only one cycle is required. moving and transferring data the t ransfer of da ta wi thin t he m icrocontroller progra m i s one of t he m ost fre quently use d operations. making use of three kinds of mov instructions, data can be transferred from registers to the accumulator and vice-versa as well as being able to move specifc immediate data directly into the ac cumulator. one of t he m ost i mportant da ta t ransfer a pplications i s t o re ceive da ta from t he input ports and transfer data to the output ports. arithmetic operations the ability to perform certain arithm etic operations and data manipula tion is a necessary feature of most m icrocontroller a pplications. w ithin t he hol tek m icrocontroller i nstruction se t a re a ra nge of add and subtract instruction mnemonics to enable the necessary arithmetic to be carried out. care must be taken to ens ure correct handling of carry and borrow data w hen res ults exceed 255 for addition and less than 0 for subtraction. the increment and decrement instructions inc, inca, dec and deca provide a simple means of increasing or decreasing by a value of one of the values in the destination specifed. logical and rotate operations the standard logical operations such as and, or, xor and cpl all have their own instruction within t he hol tek m icrocontroller i nstruction se t. as wi th t he c ase of m ost i nstructions i nvolving data m anipulation, d ata m ust p ass t hrough t he ac cumulator wh ich m ay i nvolve a dditional programming steps. in all logical data operations, the zero flag may be set if the result of the operation is zero. another form of logical data manipulation comes from the rotate instructions such as rr, rl, rrc and rlc which provide a simple means of rotating one bit right or left. dif ferent
rev. 1.40 90 ? a ??? 1 ?? ? 01 ? rev. 1.40 91 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale rotate instructions exist depending on program requirements. rotate instructions are useful for serial port progra mming a pplications whe re da ta c an be rot ated from a n i nternal re gister i nto t he ca rry bit from where it can be examined and the necessary serial bit set high or low . another application where rotate data operations are used is to implement multiplication and division calculations. branches and control transfer program branching takes the form of either jumps to specifed locations using the jmp instruction or to a subroutine using the call instruction. they dif fer in the sense that in the case of a subroutine call, the program must return to the instruction immediately when the subroutine has been carried out. this is done by placing a return instruction ret in the subroutine which will cause the program to jump back to the address right after the call instruction. in the case of a jmp instruction, the program simply jumps to the desired location. there is no requirement to jump back to the original jumping of f poi nt as in the case of the call instruct ion. one special and extremely useful set of branch instructions are the conditional branches. here a decision is first made regarding the condition of a certain data memory or individual bits. depending upon the conditions, the program will continue with the next instruction or skip over it and jump to the following instruction. these instructions are the key to decision making and branching within the program perhaps determined by the condition of certain input switches or by the condition of internal data bits. bit operations the abili ty to provide single bit operations on data memory is an extremely fexible feature of all holtek microcontrollers . this feature is especially useful for output port bit programming where individual bits or port pins can be directly set high or low using either the "set [m].i" or "clr [m]. i" instructions respectively . the feature removes the need for programmers to frst read the 8-bit output port, manipulate the input data to ensure that other bits are not changed and then output the port with the correct new data. this read-modify-write process is take n care of automatically when these bit operation instructions are used. table read operations data st orage i s norm ally i mplemented by usi ng re gisters. however , whe n worki ng wi th l arge amounts of fxed data, the volume involved often makes it inconvenient to store the fxed data in the data memory . t o overcome this problem, holtek microcontrollers allow an area of program memory to be setup as a table where data can be directly stored. a set of easy to use instructions provides the means by w hich this fixed data can be referenced and retrieved from the program memory. other operations in addition to the above functional instructions, a range of other instructions also exist such as the "hal t" i nstruction f or po wer-down o perations a nd i nstructions t o c ontrol t he o peration o f the w atchdog t imer for reliable program operations under extreme electric or electromagnetic environments. for their relevant operations, refer to the functional related sections.
rev. 1.40 90 ?a??? 1?? ?01? rev. 1.40 91 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale instruction set summary the following table depicts a summary of the instruction set categorised according to function and can be consulted as a basic instruction reference using the following listed conventions. table conventions x: bits immediate data m: data memory address a: accumulator i: 0~7 number of bits addr: program memory address mnemonic description cycles flag affected arithmetic add a ? [m] add data ? emo ? y to acc 1 z ? c ? ac ? ov add ? a ? [m] add acc to data ? emo ? y 1 note z ? c ? ac ? ov add a ? x add immediate data to acc 1 z ? c ? ac ? ov adc a ? [m] add data ? emo ? y to acc wit ? ca ?? y 1 z ? c ? ac ? ov adc ? a ? [m] add acc to data memo ? y wit ? ca ?? y 1 note z ? c ? ac ? ov sub a ? x subt ? a ? t immediate data f ? om t ? e acc 1 z ? c ? ac ? ov sub a ? [m] subt ? a ? t data ? emo ? y f ? om acc 1 z ? c ? ac ? ov sub ? a ? [m] subt ? a ? t data ? emo ? y f ? om acc wit ? ? esult in data ? emo ? y 1 note z ? c ? ac ? ov sbc a ? [m] subt ? a ? t data ? emo ? y f ? om acc wit ? ca ?? y 1 z ? c ? ac ? ov sbc ? a ? [m] subt ? a ? t data ? emo ? y f ? om acc wit ? ca ?? y ? ? esult in data ? emo ? y 1 note z ? c ? ac ? ov daa [m] de ? imal adjust acc fo ? addition wit ? ? esult in data ? emo ? y 1 note c logic operation and a ? [m] logi ? al and data ? emo ? y to acc 1 z or a ? [m] logi ? al or data ? emo ? y to acc 1 z xor a ? [m] logi ? al xor data ? emo ? y to acc 1 z and ? a ? [m] logi ? al and acc to data ? emo ? y 1 note z or ? a ? [m] logi ? al or acc to data ? emo ? y 1 note z xor ? a ? [m] logi ? al xor acc to data ? emo ? y 1 note z and a ? x logi ? al and immediate data to acc 1 z or a ? x logi ? al or immediate data to acc 1 z xor a ? x logi ? al xor immediate data to acc 1 z cpl [m] complement data ? emo ? y 1 note z cpla [m] complement data ? emo ? y wit ? ? esult in acc 1 z increment & decrement inca [m] in ?? ement data ? emo ? y wit ? ? esult in acc 1 z inc [m] in ?? ement data ? emo ? y 1 note z deca [m] de ?? ement data ? emo ? y wit ? ? esult in acc 1 z dec [m] de ?? ement data ? emo ? y 1 note z rotate rra [m] rotate data ? emo ? y ? ig ? t wit ? ? esult in acc 1 none rr [m] rotate data ? emo ? y ? ig ? t 1 note none rrca [m] rotate data ? emo ? y ? ig ? t t ?? oug ? ca ?? y wit ? ? esult in acc 1 c rrc [m] rotate data ? emo ? y ? ig ? t t ?? oug ? ca ?? y 1 note c rla [m] rotate data ? emo ? y left wit ? ? esult in acc 1 none rl [m] rotate data ? emo ? y left 1 note none rlca [m] rotate data ? emo ? y left t ?? oug ? ca ?? y wit ? ? esult in acc 1 c rlc [m] rotate data ? emo ? y left t ?? oug ? ca ?? y 1 note c
rev. 1.40 9 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 93 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale mnemonic description cycles flag affected data move ? ov a ? [m] ? ove data ? emo ? y to acc 1 none ? ov [m] ? a ? ove acc to data ? emo ? y 1 note none ? ov a ? x ? ove immediate data to acc 1 none bit operation clr [m].i clea ? bit of data ? emo ? y 1 note none set [m].i set bit of data ? emo ? y 1 note none branch j ? p add ? jump un ? onditionally ? none sz [m] skip if data ? emo ? y is ze ? o 1 note none sza [m] skip if data ? emo ? y is ze ? o wit ? data movement to acc 1 note none sz [m].i skip if bit i of data ? emo ? y is ze ? o 1 note none snz [m].i skip if bit i of data ? emo ? y is not ze ? o 1 note none siz [m] skip if in ?? ement data ? emo ? y is ze ? o 1 note none sdz [m] skip if de ?? ement data ? emo ? y is ze ? o 1 note none siza [m] skip if in ?? ement data ? emo ? y is ze ? o wit ? ? esult in acc 1 note none sdza [m] skip if de ?? ement data ? emo ? y is ze ? o wit ? ? esult in acc 1 note none call add ? sub ? outine ? all ? none ret retu ? n f ? om sub ? outine ? none ret a ? x retu ? n f ? om sub ? outine and load immediate data to acc ? none reti retu ? n f ? om inte ?? upt ? none table read tabrdc [m] read table ( ? u ?? ent page) to tblh and data ? emo ? y ? note none tabrdl [m] read table (last page) to tblh and data ? emo ? y ? note none miscellaneous nop no ope ? ation 1 none clr [m] clea ? data ? emo ? y 1 note none set [m] set data ? emo ? y 1 note none clr wdt clea ? wat ?? dog time ? 1 to ? pdf clr wdt1 p ? e- ? lea ? wat ?? dog time ? 1 to ? pdf clr wdt ? p ? e- ? lea ? wat ?? dog time ? 1 to ? pdf swap [m] swap nibbles of data ? emo ? y 1 note none swapa [m] swap nibbles of data ? emo ? y wit ? ? esult in acc 1 none halt ente ? powe ? down mode 1 to ? pdf note: 1. for skip instructions, if the result of the comparison involves a skip then two cycles are required, if no skip takes place only one cycle is required. 2. any instruction which changes the contents of the pcl will also require 2 cycles for execution. 3. for the "clr wdt1" and "clr wdt2" instructions the t o and pdf fags may be af fected by the execution status. the t o and pdf fags are cleared after both "clr wdt1" and "clr wdt2" i nstructions a re c onsecutively e xecuted. ot herwise t he t o a nd pdf fl ags re main unchanged.
rev. 1.40 9? ?a??? 1?? ?01? rev. 1.40 93 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale instruction defnition add data ? emo ? y to acc wit ? ca ?? y t ? e ? ontents of t ? e spe ? ified data ? emo ? y ? a ?? umulato ? and t ? e ? a ?? y flag a ? e added. t ? e ? esult is sto ? ed in t ? e a ?? umulato ? . acc acc + [m] + c ov ? z ? ac ? c add acc to data ? emo ? y wit ? ca ?? y t ? e ? ontents of t ? e spe ? ified data ? emo ? y ? a ?? umulato ? and t ? e ? a ?? y flag a ? e added. the result is stored in the specifed data memory. [m] acc + [m] + c ov ? z ? ac ? c add data ? emo ? y to acc the contents of the specifed data memory and the accumulator are added. the ? esult is sto ? ed in t ? e a ?? umulato ? . acc acc + [m] ov ? z ? ac ? c add immediate data to acc the contents of the accumulator and the specifed immediate data are added. the ? esult is sto ? ed in t ? e a ?? umulato ? . ac acc + x ov ? z ? ac ? c add acc to data ? emo ? y the contents of the specifed data memory and the accumulator are added. the result is stored in the specifed data memory. [m] acc + [m] ov ? z ? ac ? c logi ? al and data ? emo ? y to acc data in the accumulator and the specifed data memory perform a bitwise logical and ope ? ation. t ? e ? esult is sto ? ed in t ? e a ?? umulato ? . acc acc and [m] z logi ? al and immediate data to acc data in the accumulator and the specifed immediate data perform a bitwise logical and ope ? ation. t ? e ? esult is sto ? ed in t ? e a ?? umulato ? . acc acc and x z logi ? al and acc to data ? emo ? y data in the specifed data memory and the accumulator perform a bitwise logical and ope ? ation. t ? e ? esult is sto ? ed in t ? e data ? emo ? y. [m] acc and [m] z adc a,[m] des ?? iption ope ? ation affected fag(s) adcm a,[m] des ?? iption ope ? ation affected fag(s) add a,[m] des ?? iption ope ? ation affected fag(s) add a,x des ?? iption ope ? ation affected fag(s) addm a,[m] des ?? iption ope ? ation affected fag(s) and a,[m] des ?? iption ope ? ation affected fag(s) and a,x des ?? iption ope ? ation affected fag(s) andm a,[m] des ?? iption ope ? ation affected fag(s)
rev. 1.40 94 ? a ??? 1 ?? ? 01 ? rev. 1.40 9? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale sub ? outine ? all unconditionally calls a subroutine at the specifed address. the program counter t ? en in ?? ements by 1 to obtain t ? e add ? ess of t ? e next inst ? u ? tion w ? i ?? is t ? en pus ? ed onto t ? e sta ? k. t ? e spe ? ified add ? ess is t ? en loaded and t ? e p ? og ? am ? ontinues exe ? ution f ? om t ? is new add ? ess. as t ? is inst ? u ? tion ? equi ? es an additional ope ? ation ? it is a two ? y ? le inst ? u ? tion. sta ? k p ? og ? am counte ? + 1 p ? og ? am counte ? add ? none clea ? data ? emo ? y each bit of the specifed data memory is cleared to 0. [m] 00h none clea ? bit of data ? emo ? y bit i of the specifed data memory is cleared to 0. [m].i 0 none clea ? wat ?? dog time ? the to, pdf fags and the wdt are all cleared. wdt ? lea ? ed to 0 pdf 0 to ? pdf p ? e- ? lea ? wat ?? dog time ? the to, pdf fags and the wdtare all cleared. note that this instruction works in ? onjun ? tion wit ? clr wdt ? and must be exe ? uted alte ? nately wit ? clr wdt ? to ? ave effe ? t. repetitively exe ? uting t ? is inst ? u ? tion wit ? out alte ? nately exe ? uting clr wdt ? will ? ave no effe ? t. wdt ? lea ? ed to 0 pdf 0 to ? pdf p ? e- ? lea ? wat ?? dog time ? the to, pdf fags and the wdtare all cleared. note that this instruction works in ? onjun ? tion wit ? clr wdt1 and must be exe ? uted alte ? nately wit ? clr wdt1 to ? ave effe ? t. repetitively exe ? uting t ? is inst ? u ? tion wit ? out alte ? nately exe ? uting wdt ? lea ? ed to 0 pdf 0 to ? pdf call addr des ?? iption ope ? ation affected fag(s) clr [m] des ?? iption ope ? ation affected fag(s) clr [m].i des ?? iption ope ? ation affected fag(s) clr wdt des ?? iption ope ? ation affected fag(s) clr wdt1 des ?? iption ope ? ation affected fag(s) clr wdt2 des ?? iption ope ? ation affected fag(s)
rev. 1.40 94 ?a??? 1?? ?01? rev. 1.40 9 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale complement data ? emo ? y each bit of the specifed data memory is logically complemented (1 ' s ? omplement). bits w ? i ?? p ? eviously ? ontained a 1 a ? e ?? anged to 0 and vi ? e ve ? sa. [m] [m] z complement data ? emo ? y wit ? ? esult in acc ea ?? bit of t ? e spe ? ified data ? emo ? y is logi ? ally ? omplemented (1 ' s ? omplement). bits w ? i ?? p ? eviously ? ontained a 1 a ? e ?? anged to 0 and vi ? e ve ? sa. t ? e ? omplemented ? esult is sto ? ed in t ? e a ?? umulato ? and t ? e ? ontents of t ? e data ? emo ? y ? emain un ?? anged. acc [m] z de ? imal-adjust acc fo ? addition wit ? ? esult in data ? emo ? y conve ? t t ? e ? ontents of t ? e a ?? umulato ? value to a bcd ( bina ? y coded de ? imal) value ? esulting f ? om t ? e p ? evious addition of two bcd va ? iables. if t ? e low nibble is greater than 9 or if ac fag is set, then a value of 6 will be added to the low nibble. ot ? e ? wise t ? e low nibble ? emains un ?? anged. if t ? e ? ig ? nibble is g ? eate ? t ? an 9 or if the c fag is set, then a value of 6 will be added to the high nibble. essentially, t ? e de ? imal ? onve ? sion is pe ? fo ? med by adding 00h ? 06h ? 60h o ? 66h depending on the accumulator and fag conditions. only the c fag may be affected by this inst ? u ? tion w ? i ?? indi ? ates t ? at if t ? e o ? iginal bcd sum is g ? eate ? t ? an 100 ? it allows multiple p ? e ? ision de ? imal addition. [m] acc + 00h or [m] acc + 06h or [m] acc + 60h or [m] acc + 66h c de ?? ement data ? emo ? y data in the specifed data memory is decremented by 1. [m] [m] C 1 z de ?? ement data ? emo ? y wit ? ? esult in acc data in the specifed data memory is decremented by 1. the result is stored in the a ?? umulato ? . t ? e ? ontents of t ? e data ? emo ? y ? emain un ?? anged. acc [m] C 1 z cpl [m] des ?? iption ope ? ation affected fag(s) cpla [m] des ?? iption ope ? ation affected fag(s) daa [m] des ?? iption ope ? ation affected fag(s) dec [m] des ?? iption ope ? ation affected fag(s) deca [m] des ?? iption ope ? ation affected fag(s)
rev. 1.40 96 ? a ??? 1 ?? ? 01 ? rev. 1.40 97 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ente ? powe ? down mode t ? is inst ? u ? tion stops t ? e p ? og ? am exe ? ution and tu ? ns off t ? e system ? lo ? k. t ? e ? ontents of t ? e data ? emo ? y and ? egiste ? s a ? e ? etained. t ? e wdt and p ? es ? ale ? a ? e ? lea ? ed. t ? e powe ? down flag pdf is set and t ? e wdt time-out flag to is ? lea ? ed. to 0 pdf 0 to ? pdf in ?? ement data ? emo ? y data in the specifed data memory is incremented by 1. [m] [m]+1 z in ?? ement data ? emo ? y wit ? ? esult in acc data in the specifed data memory is incremented by 1. the result is stored in the a ?? umulato ? . t ? e ? ontents of t ? e data ? emo ? y ? emain un ?? anged. acc [m]+1 z jump un ? onditionally t ? e ? ontents of t ? e p ? og ? am counte ? a ? e ? epla ? ed wit ? t ? e spe ? ified add ? ess. p ? og ? am exe ? ution t ? en ? ontinues f ? om t ? is new add ? ess. as t ? is ? equi ? es t ? e inse ? tion of a dummy inst ? u ? tion w ? ile t ? e new add ? ess is loaded ? it is a two ? y ? le inst ? u ? tion. p ? og ? am counte ? add ? none ? ove data ? emo ? y to acc the contents of the specifed data memory are copied to the accumulator. acc [m] none ? ove immediate data to acc the immediate data specifed is loaded into the accumulator. acc x none ? ove acc to data ? emo ? y the contents of the accumulator are copied to the specifed data memory. [m] acc none no ope ? ation no ope ? ation is pe ? fo ? med. exe ? ution ? ontinues wit ? t ? e next inst ? u ? tion. no ope ? ation none halt des ?? iption ope ? ation affected fag(s) inc [m] des ?? iption ope ? ation affected fag(s) inca [m] des ?? iption ope ? ation affected fag(s) jmp addr des ?? iption ope ? ation affected fag(s) mov a,[m] des ?? iption ope ? ation affected fag(s) mov a,x des ?? iption ope ? ation affected fag(s) mov [m],a des ?? iption ope ? ation affected fag(s) nop des ?? iption ope ? ation affected fag(s)
rev. 1.40 96 ?a??? 1?? ?01? rev. 1.40 97 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale logi ? al or data ? emo ? y to acc data in the accumulator and the specifed data memory perform a bitwise logical or ope ? ation. t ? e ? esult is sto ? ed in t ? e a ?? umulato ? . acc acc " or " [m] z logi ? al or immediate data to acc data in the accumulator and the specifed immediate data perform a bitwise logical or ope ? ation. t ? e ? esult is sto ? ed in t ? e a ?? umulato ? . acc acc " or " x z logi ? al or acc to data ? emo ? y data in the specifed data memory and the accumulator perform a bitwise logical or ope ? ation. t ? e ? esult is sto ? ed in t ? e data ? emo ? y. [m] acc " or " [m] z retu ? n f ? om sub ? outine t ? e p ? og ? am counte ? is ? esto ? ed f ? om t ? e sta ? k. p ? og ? am exe ? ution ? ontinues at t ? e ? esto ? ed add ? ess. p ? og ? am counte ? sta ? k none retu ? n f ? om sub ? outine and load immediate data to acc t ? e p ? og ? am counte ? is ? esto ? ed f ? om t ? e sta ? k and t ? e a ?? umulato ? loaded wit ? t ? e spe ? ified immediate data. p ? og ? am exe ? ution ? ontinues at t ? e ? esto ? ed add ? ess. p ? og ? am counte ? sta ? k acc x none retu ? n f ? om inte ?? upt t ? e p ? og ? am counte ? is ? esto ? ed f ? om t ? e sta ? k and t ? e inte ?? upts a ? e ? e-enabled by setting t ? e e ? i bit. e ? i is t ? e maste ? inte ?? upt global enable bit. if an inte ?? upt was pending w ? en t ? e reti inst ? u ? tion is exe ? uted ? t ? e pending inte ?? upt ? outine will be p ? o ? essed befo ? e ? etu ? ning to t ? e main p ? og ? am. p ? og ? am counte ? sta ? k e ? i 1 none rotate data ? emo ? y left the contents of the specifed data memory are rotated left by 1 bit with bit 7 rotated into bit 0. [m].(i+1) [m].i; (i = 0~6) [m].0 [m].7 none or a,[m] des ?? iption ope ? ation affected fag(s) or a,x des ?? iption ope ? ation affected fag(s) orm a,[m] des ?? iption ope ? ation affected fag(s) ret des ?? iption ope ? ation affected fag(s) ret a, des ?? iption ope ? ation affected fag(s) reti des ?? iption ope ? ation affected fag(s) rl [m] des ?? iption ope ? ation affected fag(s)
rev. 1.40 98 ? a ??? 1 ?? ? 01 ? rev. 1.40 99 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale rotate data ? emo ? y left wit ? ? esult in acc the contents of the specifed data memory are rotated left by 1 bit with bit 7 rotated into bit 0. t ? e ? otated ? esult is sto ? ed in t ? e a ?? umulato ? and t ? e ? ontents of t ? e data ? emo ? y ? emain un ?? anged. acc.(i+1) [m].i; (i = 0~6) acc.0 [m].7 none rotate data ? emo ? y left t ?? oug ? ca ?? y the contents of the specifed data memory and the carry fag are rotated left by 1 bit. bit 7 replaces the carry bit and the original carry fag is rotated into bit 0. [m].(i+1) [m].i; (i = 0~6) [m].0 c c [m].7 c rotate data ? emo ? y left t ?? oug ? ca ?? y wit ? ? esult in acc data in the specifed data memory and the carry fag are rotated left by 1 bit. bit 7 replaces the carry bit and the original carry fag is rotated into the bit 0. the rotated ? esult is sto ? ed in t ? e a ?? umulato ? and t ? e ? ontents of t ? e data ? emo ? y ? emain un ?? anged. acc.(i+1) [m].i; (i = 0~6) acc.0 c c [m].7 c rotate data ? emo ? y ? ig ? t t ? e ? ontents of t ? e spe ? ified data ? emo ? y a ? e ? otated ? ig ? t by 1 bit wit ? bit 0 ? otated into bit 7. [m].i [m].(i+1); (i = 0~6) [m].7 [m].0 none rotate data ? emo ? y ? ig ? t wit ? ? esult in acc data in t ? e spe ? ified data ? emo ? y and t ? e ? a ?? y flag a ? e ? otated ? ig ? t by 1 bit wit ? bit 0 ? otated into bit 7. t ? e ? otated ? esult is sto ? ed in t ? e a ?? umulato ? and t ? e ? ontents of t ? e data ? emo ? y ? emain un ?? anged. acc.i [m].(i+1); (i = 0~6) acc.7 [m].0 none rotate data ? emo ? y ? ig ? t t ?? oug ? ca ?? y the contents of the specifed data memory and the carry fag are rotated right by 1 bit. bit 0 replaces the carry bit and the original carry fag is rotated into bit 7. [m].i [m].(i+1); (i = 0~6) [m].7 c c [m].0 c rla [m] des ?? iption ope ? ation affected fag(s) rlc [m] des ?? iption ope ? ation affected fag(s) rlca [m] des ?? iption ope ? ation affected fag(s) rr [m] des ?? iption ope ? ation affected fag(s) rra [m] des ?? iption ope ? ation affected fag(s) rrc [m] des ?? iption ope ? ation affected fag(s)
rev. 1.40 98 ?a??? 1?? ?01? rev. 1.40 99 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale rotate data ? emo ? y ? ig ? t t ?? oug ? ca ?? y wit ? ? esult in acc data in the specifed data memory and the carry fag are rotated right by 1 bit. bit 0 replaces the carry bit and the original carry fag is rotated into bit 7. the rotated ? esult is sto ? ed in t ? e a ?? umulato ? and t ? e ? ontents of t ? e data ? emo ? y ? emain un ?? anged. acc.i [m].(i+1); (i = 0~6) acc.7 c c [m].0 c subt ? a ? t data ? emo ? y f ? om acc wit ? ca ?? y the contents of the specifed data memory and the complement of the carry fag a ? e subt ? a ? ted f ? om t ? e a ?? umulato ? . t ? e ? esult is sto ? ed in t ? e a ?? umulato ? . note that if the result of subtraction is negative, the c fag will be cleared to 0, otherwise if the result is positive or zero, the c fag will be set to 1. acc acc C [m] C c ov ? z ? ac ? c subt ? a ? t data ? emo ? y f ? om acc wit ? ca ?? y and ? esult in data ? emo ? y the contents of the specifed data memory and the complement of the carry fag a ? e subt ? a ? ted f ? om t ? e a ?? umulato ? . t ? e ? esult is sto ? ed in t ? e data ? emo ? y. note that if the result of subtraction is negative, the c fag will be cleared to 0, otherwise if the result is positive or zero, the c fag will be set to 1. acc acc C [m] C c ov ? z ? ac ? c skip if de ?? ement data ? emo ? y is 0 the contents of the specifed data memory are frst decremented by 1. if the result is 0 t ? e following inst ? u ? tion is skipped. as t ? is ? equi ? es t ? e inse ? tion of a dummy inst ? u ? tion w ? ile t ? e next inst ? u ? tion is fet ?? ed ? it is a two ? y ? le inst ? u ? tion. if t ? e ? esult is not 0 t ? e p ? og ? am p ? o ? eeds wit ? t ? e following inst ? u ? tion. [m] [m] C 1 skip if [m] = 0 none skip if de ?? ement data ? emo ? y is ze ? o wit ? ? esult in acc the contents of the specifed data memory are frst decremented by 1. if the result is 0 ? t ? e following inst ? u ? tion is skipped. t ? e ? esult is sto ? ed in t ? e a ?? umulato ? but the specifed data memory contents remain unchanged. as this requires the inse ? tion of a dummy inst ? u ? tion w ? ile t ? e next inst ? u ? tion is fet ?? ed ? it is a two ? y ? le inst ? u ? tion. if t ? e ? esult is not 0 ? t ? e p ? og ? am p ? o ? eeds wit ? t ? e following inst ? u ? tion. acc [m] C 1 skip if acc = 0 none rrca [m] des ?? iption ope ? ation affected fag(s) sbc a,[m] des ?? iption ope ? ation affected fag(s) sbcm a,[m] des ?? iption ope ? ation affected fag(s) sdz [m] des ?? iption ope ? ation affected fag(s) sdza [m] des ?? iption ope ? ation affected fag(s)
rev. 1.40 100 ? a ??? 1 ?? ? 01 ? rev. 1.40 101 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale set data ? emo ? y each bit of the specifed data memory is set to 1. [m] ffh none set bit of data ? emo ? y bit i of the specifed data memory is set to 1. [m].1 1 none skip if in ?? ement data ? emo ? y is 0 the contents of the specifed data memory are frst incremented by 1. if the result is 0 ? t ? e following inst ? u ? tion is skipped. as t ? is ? equi ? es t ? e inse ? tion of a dummy inst ? u ? tion w ? ile t ? e next inst ? u ? tion is fet ?? ed ? it is a two ? y ? le inst ? u ? tion. if t ? e ? esult is not 0 t ? e p ? og ? am p ? o ? eeds wit ? t ? e following inst ? u ? tion. [m] [m] + 1 skip if [m] = 0 none skip if in ?? ement data ? emo ? y is ze ? o wit ? ? esult in acc the contents of the specifed data memory are frst incremented by 1. if the result is 0 ? t ? e following inst ? u ? tion is skipped. t ? e ? esult is sto ? ed in t ? e a ?? umulato ? but the specifed data memory contents remain unchanged. as this requires the inse ? tion of a dummy inst ? u ? tion w ? ile t ? e next inst ? u ? tion is fet ?? ed ? it is a two ? y ? le inst ? u ? tion. if t ? e ? esult is not 0 t ? e p ? og ? am p ? o ? eeds wit ? t ? e fol lowing inst ? u ? tion. acc [m] + 1 skip if acc = 0 none skip if bit i of data ? emo ? y is not 0 if bit i of the specifed data memory is not 0, the following instruction is skipped. as t ? is ? equi ? es t ? e inse ? tion of a dummy inst ? u ? tion w ? il e t ? e next inst ? u ? tion is fet ?? ed ? it is a two ? y ? le inst ? u ? tion. if t ? e ? esult is 0 t ? e p ? og ? am p ? o ? eeds wit ? t ? e following inst ? u ? tion. skip if [m].i 0 none subt ? a ? t data ? emo ? y f ? om acc the specifed data memory is subtracted from the contents of the accumulator. the ? esult is sto ? ed in t ? e a ?? umulato ? . note t ? at if t ? e ? esult of subt ? a ? tion is negative ? the c fag will be cleared to 0, otherwise if the result is positive or zero, the c fag will be set to 1. acc acc C [m] ov ? z ? ac ? c set [m] des ?? iption ope ? ation affected fag(s) set [m].i des ?? iption ope ? ation affected fag(s) siz [m] des ?? iption ope ? ation affected fag(s) siza [m] des ?? iption ope ? ation affected fag(s) snz [m].i des ?? iption ope ? ation affected fag(s) sub a,[m] des ?? iption ope ? ation affected fag(s)
rev. 1.40 100 ?a??? 1?? ?01? rev. 1.40 101 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale subt ? a ? t data ? emo ? y f ? om acc wit ? ? esult in data ? emo ? y the specifed data memory is subtracted from the contents of the accumulator. the ? esult is sto ? ed in t ? e data ? emo ? y. note t ? at if t ? e ? esult of subt ? a ? tion is negative ? the c fag will be cleared to 0, otherwise if the result is positive or zero, the c fag will be set to 1. [m] acc C [m] ov ? z ? ac ? c subt ? a ? t immediate data f ? om acc the immediate data specifed by the code is subtracted from the contents of the a ?? umulato ? . t ? e ? esult is sto ? ed in t ? e a ?? umulato ? . note t ? at if t ? e ? esult of subt ? a ? tion is negative ? t ? e c flag will be ? lea ? ed to 0 ? ot ? e ? wise if t ? e ? esult is positive or zero, the c fag will be set to 1. acc acc C x ov ? z ? ac ? c swap nibbles of data ? emo ? y t ? e low-o ? de ? and ? ig ? -o ? de ? nibbles of t ? e spe ? ified data ? emo ? y a ? e inte ??? anged. [m].3~[m].0?[m].7 ~ [m].4 none swap nibbles of data ? emo ? y wit ? ? esult in acc t ? e low-o ? de ? and ? ig ? -o ? de ? nibbles of t ? e spe ? ified data ? emo ? y a ? e inte ??? anged. t ? e ? esult is sto ? ed in t ? e a ?? umulato ? . t ? e ? ontents of t ? e data ? emo ? y ? emain un ?? anged. acc.3 ~ acc.0 [m].7 ~ [m].4 acc.7 ~ acc.4 [m].3 ~ [m].0 none skip if data ? emo ? y is 0 if t ? e ? ontents of t ? e spe ? ified data ? emo ? y is 0 ? t ? e following inst ? u ? tion is skipped. as t ? is ? equi ? es t ? e inse ? tion of a dummy inst ? u ? tion w ? ile t ? e next inst ? u ? tion is fet ?? ed ? it is a two ? y ? le inst ? u ? tion. if t ? e ? esult is not 0 t ? e p ? og ? am p ? o ? eeds wit ? t ? e following inst ? u ? tion. skip if [m] = 0 none skip if data ? emo ? y is 0 wit ? data movement to acc the contents of the specifed data memory are copied to the accumulator. if the value is ze ? o ? t ? e following inst ? u ? tion is skipped. as t ? is ? equi ? es t ? e inse ? tion of a dummy inst ? u ? tion w ? ile t ? e next inst ? u ? tion is fet ?? ed ? it is a two ? y ? le inst ? u ? tion. if t ? e ? esult is not 0 t ? e p ? og ? am p ? o ? eeds wit ? t ? e following inst ? u ? tion. acc [m] skip if [m] = 0 none subm a,[m] des ?? iption ope ? ation affected fag(s) sub a,x des ?? iption ope ? ation affected fag(s) swap [m] des ?? iption ope ? ation affected fag(s) swapa [m] des ?? iption ope ? ation affected fag(s) sz [m] des ?? iption ope ? ation affected fag(s) sza [m] des ?? iption ope ? ation affected fag(s)
rev. 1.40 10 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 103 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale skip if bit i of data ? emo ? y is 0 if bit i of the specifed data memory is 0, the following instruction is skipped. as this ? equi ? es t ? e inse ? tion of a dummy inst ? u ? tion w ? ile t ? e next inst ? u ? tion is fet ?? ed ? it is a two ? y ? le inst ? u ? tion. if t ? e ? esult is not 0 ? t ? e p ? og ? am p ? o ? eeds wit ? t ? e following inst ? u ? tion. skip if [m].i = 0 none read table ( ? u ?? ent page) to tblh and data ? emo ? y t ? e low byte of t ? e p ? og ? am ? ode ( ? u ?? ent page) add ? essed by t ? e table pointe ? (tblp) is moved to the specifed data memory and the high byte moved to tblh. [m] p ? og ? am ? ode (low byte) tblh p ? og ? am ? ode ( ? ig ? byte) none read table (last page) to tblh and data ? emo ? y t ? e low byte of t ? e p ? og ? am ? ode (last page) add ? essed by t ? e table pointe ? (tblp) is moved to the specifed data memory and the high byte moved to tblh. [m] p ? og ? am ? ode (low byte) tblh p ? og ? am ? ode ( ? ig ? byte) none logi ? al xor data ? emo ? y to acc data in the accumulator and the specifed data memory perform a bitwise logical xor ope ? ation. t ? e ? esult is sto ? ed in t ? e a ?? umulato ? . acc acc " xor " [m] z logi ? al xor acc to data ? emo ? y data in the specifed data memory and the accumulator perform a bitwise logical xor ope ? ation. t ? e ? esult is sto ? ed in t ? e data ? emo ? y. [m] acc " xor " [m] z logi ? al xor immediate data to acc data in the accumulator and the specifed immediate data perform a bitwise logical xor ope ? ation. t ? e ? esult is sto ? ed in t ? e a ?? umulato ? . acc acc " xor " x z sz [m].i des ?? iption ope ? ation affected fag(s) tabrdc [m] des ?? iption ope ? ation affected fag(s) tabrdl [m] des ?? iption ope ? ation affected fag(s) xor a,[m] des ?? iption ope ? ation affected fag(s) xorm a,[m] des ?? iption ope ? ation affected fag(s) xor a,x des ?? iption ope ? ation affected fag(s)
rev. 1.40 10? ?a??? 1?? ?01? rev. 1.40 103 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale package information note that the package information provided here is for consultation purposes only . as this information may be updated at regular intervals users are reminded to consult the holtek website for the latest version of the package information. additional supplementary information with regard to pa ckaging is listed below. click on the relevant section to be transferred to the relevant website page. ? further package information (include outline dimensions, product t ape and reel specifcations) ? packing meterials information ? carton information
rev. 1.40 104 ? a ??? 1 ?? ? 01 ? rev. 1.40 10? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale 80-pin lqfp (10mm10mm) outline dimensions                     symbol dimensions in inch min. nom. max. a D 0.47 ? bsc D b D 0.394 bsc D c D 0.47 ? bsc D d D 0.394 bsc D e D 0.016 bsc D f 0.007 0.009 0.011 g 0.0 ? 3 0.0 ?? 0.0 ? 7 h D D 0.063 i 0.00 ? D 0.006 j 0.018 0.0 ? 4 0.030 k 0.004 D 0.008 0 D 7 symbol dimensions in mm min. nom. max. a 1 ? bsc b 10 bsc c 1 ? bsc d 10 bsc e D 0.4 bsc D f 0.13 0.18 0. ? 3 g 1.3 ? 1.4 1.4 ? h D D 1.60 i 0.0 ? 0.1 ? j 0.4 ? 0.60 0.7 ? k 0.09 D 0. ? 0 0 D 7
rev. 1.40 104 ?a??? 1?? ?01? rev. 1.40 10 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale copy ? ig ? t ? ? 01 ? by holtek se ? iconductor inc. t ? e info ? mat ion appea ? ing in t ? is data s ? eet is believed to be a ?? u ? ate at t ? e time of publi ? ation. howeve ?? holtek assumes no ? esponsibility a ? ising f ? om t ? e use of the specifcations described. the applications mentioned herein are used solely fo ? t ? e pu ? pose of illust ? ation and holtek makes no wa ?? anty o ? ? ep ? esentation t ? at su ?? appli ? ations will be suitable wit ? out fu ? t ? e ? modifi ? ation ? no ? ? e ? ommends t ? e use of its p ? odu ? ts fo ? appli ? ation t ? at may p ? esent a ? isk to ? uman life due to malfun ? t ion o ? ot ? e ? wis e. holtek's p ? odu ? t s a ? e not aut ? o ? iz ed fo ? us e as ?? it i ? al ? omponents in life suppo ? t devi ? es o ? systems. holtek ? ese ? ves t ? e ? ig ? t to alte ? its products without prior notifcation. for the most up-to-date information, please visit ou ? web site at ? ttp://www. ? oltek. ? om.tw.


▲Up To Search▲   

 
Price & Availability of HT45R2K-A

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X